[eluser]Pascal Kriete[/eluser]
Quote:So basically what I’m trying to make is a page handler that is called at the end of a function when I want to display a page instead of $this->load->view(‘blah’);
Lots of ways to do this. You can nest views, so you could create a template view:
Code:
<html>
<?php $this->load->view('general/header'); ?>
<?php $this->load->view($content); ?>
<?php $this->load->view('general/footer'); ?>
</html>
And then all you would need to do is define a content variable that references another view:
Code:
$data['title'] = 'My great Title';
$data['animal'] = 'Pelican';
$data['content'] = 'earth/fauna';
$this->load->view('general/template', $data);
The data variables are automagically available to all nested views.
You could take it a step further and create a library that does that logic for you, So it might have a function like this:
Code:
function render($content, $data)
{
$data['content'] = $content;
$this->CI->load->view('general/template', $data);
}
// Used as above, but instead of data['content']
// you pass the name of the view
$this->libraryname->render('earth/fauna', $data);
Hope I understood the question correctly
.