Welcome Guest, Not a member yet? Register   Sign In
Require_once in all controller, but not in all...
#2

[eluser]tonanbarbarian[/eluser]
why not try something like this
add the following code to your controllers
Code:
function _output($output) {
    if (!$this->_ajax) {
        require(’E:/SHARED/DAWEB/progettiweb/myproject/php_speedy/php_speedy.php’);
        echo $output;
        $compressor->finish();
    } else {
        echo $output;
    }
}
This will use your compression code if the _ajax property of the controller is false
So then you just need to declare the variable in the controller
Code:
class XXX extends Controller {

    var $_ajax = false;

    function xxx() {
    }
    ...
}
and then if the method in the controller will be returning ajax set the property to true
Code:
$this->_ajax = true;
much neater and you do not have to put the code in multiple times


Messages In This Thread
Require_once in all controller, but not in all... - by El Forum - 02-05-2008, 08:09 AM
Require_once in all controller, but not in all... - by El Forum - 02-05-2008, 02:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB