![]() |
Require_once in all controller, but not in all... - 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: Require_once in all controller, but not in all... (/showthread.php?tid=5823) |
Require_once in all controller, but not in all... - El Forum - 02-05-2008 [eluser]daweb[/eluser] Hi guys. My problem today is: I have to include this code: require('E:/SHARED/DAWEB/progettiweb/myproject/php_speedy/php_speedy.php'); [MY PAGES] $compressor->finish(); at the very top and very bottom of all my pages to compress css and js files. I think to put the two lines in index.php, but there's a problem when there is an ajax call. And if your script is redirecting to another location (Ajax) then there’s nothing to compress, so don’t add the PHP Speedy code to that page. So, I have to put the two lines of code in all my controllers, not in ones that returns an Ajax call... Some ideas to do that? I think is not the best way write the lines in all my controllers... Thank you, sorry for english. Require_once in all controller, but not in all... - El Forum - 02-05-2008 [eluser]tonanbarbarian[/eluser] why not try something like this add the following code to your controllers Code: function _output($output) { So then you just need to declare the variable in the controller Code: class XXX extends Controller { Code: $this->_ajax = true; |