Welcome Guest, Not a member yet? Register   Sign In
Variable data in static views
#4

[eluser]elambiguo[/eluser]
Basically....

Code:
<div id=header>
    &lt;?php echo $this->load->view($header_data)?&gt;
</div>

<div id=right_column>
    &lt;?php echo $this->load->view($right_column_data)?&gt;
</div>

<div id=main>
    &lt;?php echo $this->load->view($may_variate)?&gt;
</div>


I thing that this is correct....

In cotroller......
Code:
function index(){

     $data["header_data"] = "Tralala" // view for header...
     $data["may_variate"] = "Hello" // View for ......
     $data["right_column_data"] = "Something" // view for right column....
     $this->load->view('layout/layout', $data);

}


Quote:My question is. It's abssolutly necessary to load in every controller the '$data["my_right_column_view_DATA"]' variable?, (What if i have hundreds of controllers? it's not really scalable or maintainable)

Not... you can use one variable session for all....
Only change the variable in the load->view for one $this->userdata

Quote:Maybe one workaround is to let the "my_right_column_view" have a call to my model and load the data from the database, but i don't think that's a good practice.

Is there something that i'm missing? It's possible to have a "data preload" for the right column view? (maybe a trick with hooks?)

You can see the user guide... or the wiki...

Quote:Ps. Sorry for my english, i've lost a lot of practice :red:

Uh.... one more!!! :-)

I hope you help....


Messages In This Thread
Variable data in static views - by El Forum - 03-23-2010, 11:07 AM
Variable data in static views - by El Forum - 03-23-2010, 11:17 AM
Variable data in static views - by El Forum - 03-23-2010, 11:21 AM
Variable data in static views - by El Forum - 03-23-2010, 11:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB