View in side another view with same parameters |
[eluser]Nisha S.[/eluser]
I want to load a common sub view inside many other views but by passing the same data which is passed to the main view. Please let me know how I can achieve this. Thank you.
[eluser]Sanjay Sarvaiya[/eluser]
Please read a thread http://ellislab.com/forums/viewthread/65586/
[eluser]Samus[/eluser]
[quote author="Nisha S." date="1339479791"]I want to load a common sub view inside many other views but by passing the same data which is passed to the main view. Please let me know how I can achieve this. Thank you.[/quote] You don't have to do anything, the data you pass to one view gets 'inherited' in other views loaded by that parent view. e.g Code: $data['test'] = 'testing this'; then in parent Code: $this->load->view('child'); Code: $this->load->view('grandchild');
[eluser]Nisha S.[/eluser]
Thank you Samus. I was thinking in a too complex way..
[eluser]CroNiX[/eluser]
You can also use load::vars($array) to make variables available globally, and then you don't have to explicitly pass them to a view; they will just be available. Code: $data['page_title'] = 'my title'; |
Welcome Guest, Not a member yet? Register Sign In |