CodeIgniter Forums
Items called on each page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Items called on each page (/showthread.php?tid=45351)



Items called on each page - El Forum - 09-18-2011

[eluser]Unknown[/eluser]
Im getting used to codeigniter and didn't know how to ask for this to pull it up on google. Basically I need to know the suggested
best place to put site wide things like header and nav menus.

1) My top navigation menu is an array I can turn cells on or off to tell the user which page he is on.

public $topNav = array(
'home' => array('','active')
,'about' => array('general_info/about/','')
,'tech' => array('general_info/tech/','')
,'prod' => array('prod/','')
,'cont' => array('general_info/cont/','')
);

Right now I have this on every controller. I would rather just have the nav array held in like a helper? then just modify the array
cell with the correct data within my controllers active method. For example:

$this->helper->menu->topNave['tech'] =array( 'general_info/newTech','active');

2) Header Footer wrapper
$this->load->view('siteWrappers/'.$this->config->item('template').'/'.$this->config->item('template').'_Header');
$this->load->view('siteBody/main_view',$data);
$this->load->view('siteWrappers/'.$this->config->item('template').'/'.$this->config->item('template').'_Footer');

I have something like this in every controllers method. There has to be a place I can wrap the view content, but I don't know
how to find it. (At least the suggested spot, i'd rather not hack CI's code)

Thanks for any help.