Few lame questions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Few lame questions (/showthread.php?tid=5006) |
Few lame questions - El Forum - 12-30-2007 [eluser]Mantas M[/eluser] Is it possible to have globaly loaded stuff in a hook class somehow? For example, to have a hook extended by hookController or smth? Also, is it possible to use multiple Views? One to handle header, another for the content etc. Few lame questions - El Forum - 12-30-2007 [eluser]Craig A Rodway[/eluser] For multiple views, I recommend Method 2 as described in the wiki. Few lame questions - El Forum - 12-30-2007 [eluser]Phil Sturgeon[/eluser] Its not too easy setting default variables in a hook as hooks dont return data without setting a session var or something. Try making a base class. This basically involves making a class called something like BaseController or Globals or something. Try one like this: Code: <? Then in your other controllers, instead of extending Controller you extend Globals like so: Code: <? Everything in the $this->data which is created in Globals will be available in any of its child controllers, and in any views that are passed the $this->data variable. Few lame questions - El Forum - 12-31-2007 [eluser]Mantas M[/eluser] Thanks for the tips. What I like in CI... That it's easy to hack hehe. It wouldnt be so easy to modify core of z I think Few lame questions - El Forum - 12-31-2007 [eluser]Phil Sturgeon[/eluser] Thats what I LOVE about CI. If you want rigid rules and lameness then go use Cake or Zend frameworks. CI lets you do what you damn well please! Few lame questions - El Forum - 12-31-2007 [eluser]Josh Giese[/eluser] Thanks for posting this. I'm 3 days into CI and I was wondering how to do something like this! I cant wait to go home and try it. |