• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hooks don't work

#5
[eluser]erik.brannstrom[/eluser]
noctrum is right, you can't use the global CI object in your pre-controller hook since it doesn't exist, which I didn't think of. I guess you could probably create some hack that appends the header to the output class, but to be honest I doubt there will be any good way.

Since you will have to load your main view in each controller method anyway, why not create a template view that includes both the header and footer and pass the main view to that template?

Code:
// controller method
$this->load->view('template', array('partial_view' => $this->load->view('my_view', '', true);

// template.php
<html>
<!-- more header code.. -->
<?=$my_view?>
<!-- footer code.. -->
</html>

Or you could just pass the name of the view to the template, and let it load the partial view itself. Does this seem like a good solution to you?


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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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