Newbie Question

I've only been using CodeIgniter for one day, so apologies if this is an incredibly stupid question!
I've created a view to generate an HTML header which will be used across all pages on my application. I've worked out how to store paths to CSS, Javascript files etc. along with metadata like keywords, title info etc. in the config file and then calling it in the controller using
$data[foo] = $this->config->item[foo];
before passing it to the view.
Surely there is someway that I don't have to assign all these elements into the $data array for every controller that I write. Could someone explain how best to it?
Many thanks.

Hi Nicholas and welcome to the CI forums.

I suspect you want to read [url=""]this page in the wiki[/url] - it'll point you at extending your core controller - using the MY_Controller stuff. This is also documented in the manual, but have a read of my wiki page first and see if that makes sense.

You'll get a few gains there - title info should probably only really be displayed in one view file (a partial that contains header information), config stuff can be pulled in at MY_Controller into $this->foo type variables so they're accessible everywhere else (though this defeats much of the benefit of using the Config class, I think).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.