Welcome Guest, Not a member yet? Register   Sign In
Hooks don't work
#6

[eluser]mddd[/eluser]
It seems to me that using hooks for this kind of thing is just not the way to go. By using hooks for header/footer you are building a very inflexible system.
Not only do you have to jump through hoops to load a view in the 'header' hook - because some parts of CI aren't even loaded yet at that stage - but also you are making a system that will ALWAYS put out the same header. I thinks that is dumb.

What if you need a custom title in the header view? You can't do that because you probably don't know the title until you are in the controller. What if you want to put out a xml file (for instance for building an rss feed)? You can't, because no matter what you do, every call to CI will result in some html being outputted.

I'm all for making things easy. But putting out headers and footers using hooks is NOT making things easy. It's just creating restrictions.

Here's a crazy idea: put one line of code at the top of your 'content view':
Code:
$this->load->view('header_view');
. One more line on the bottom:
Code:
$this->load->view('footer_view');
. That's it, you're done. And the views will be able to use all the variables from your content view. And you can build specific views for other data types such as xml documents, css, whatever.


Messages In This Thread
Hooks don't work - by El Forum - 06-08-2010, 12:27 PM
Hooks don't work - by El Forum - 06-08-2010, 02:30 PM
Hooks don't work - by El Forum - 06-08-2010, 03:28 PM
Hooks don't work - by El Forum - 06-08-2010, 10:48 PM
Hooks don't work - by El Forum - 06-09-2010, 12:42 AM
Hooks don't work - by El Forum - 06-09-2010, 02:03 AM
Hooks don't work - by El Forum - 06-09-2010, 12:34 PM
Hooks don't work - by El Forum - 06-09-2010, 01:05 PM
Hooks don't work - by El Forum - 06-09-2010, 01:47 PM
Hooks don't work - by El Forum - 06-22-2010, 09:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB