Welcome Guest, Not a member yet? Register   Sign In
Parser Library
#1

[eluser]jurlan[/eluser]
Hi all,

is it possible to also load view files within a template view file?

my template.php file contains navigation and there's 1 section that changes accordingly to the link clicked.
So I don't only need to pars {title} and stuff, but also the view file belonging to the link.

Thanks in advance!
#2

[eluser]PhilTem[/eluser]
Yes, this is possible. You can have lines like this in any of your views

Code:
$this->load->view('another/view');

though you need to be careful because of possible changes in the scope of $this. It's actually better to load your views in the controller and assign the "sub"-views a variable which will just be echoed in your view:

controller:
Code:
$sub_view = $this->load->view('path/to/sub/view', NULL, TRUE);

$this->load->view('path/to/main/view', array('sub_view' => $sub_view));

path/to/main/view:
Code:
// all your other code here

echo $sub_view;

// all the rest of the other code here
#3

[eluser]jurlan[/eluser]
I just came across this: http://www.jenssegers.be/blog/25/Codeign...te-library
Think I might give it a shot...




Theme © iAndrew 2016 - Forum software by © MyBB