Welcome Guest, Not a member yet? Register   Sign In
loading a view file within template
#1

[eluser]roblarter[/eluser]
In the template.php page for example:
Code:
$template['default']['regions']['footer'] = array('content' => array(''));

I want to load a view file from the actual template.php page rather than having to use:
Code:
$this->template->write_view('footer', 'global/v_search_bar');

in the controller, is this possible?

i.e. to have the global/v_search_bar view file loaded within the template file somehow?

Code:
$template['default']['regions']['footer'] = array('content' => array(''));
#2

[eluser]Colin Williams[/eluser]
Can your master_template not just have the code from 'global/v_search_bar.php' in it? In other words, does it need to live in a separate file? If it must, don't be afraid to use PHP's include or require directives

If it contains dynamic data, you can serve that up with $this->load->vars() called in your controller (likely in the constructor). You could also do it in a parent controller (MY_Controller)

I've conceived a few solutions for configuring default views, but it raises security concerns in some regards, at least in the way I want to implement it. Could come in a later release.




Theme © iAndrew 2016 - Forum software by © MyBB