Michał Kalkowski
Michał Kalkowski

Reputation: 467

Zend Framework How to disable a controller

When I put this addres example.com/js/config I need to load a config file for JS but router loading a controller and displays error beacouse the controller dosn't exists. In bootstrap file I put a _init method:

 protected function _initJsConfig(){
    $this->bootstrap('frontController');
    $oFront = $this->getResource('frontController');
    $oFront->setRequest(new Zend_Controller_Request_Http());
    $oRequest = $oFront->getRequest();
    $oRequest->setDispatched(false);
    //$oFront = Zend_Controller_Front::getInstance()->getRequest();
    if($oRequest->getControllerName() == 'js' && $oRequest->getActionName() == 'config'){
        include('/config/config.js.php');

        return;
    }
}

But this doesn't work. Any ideas? Best regards.

Upvotes: -1

Views: 230

Answers (1)

RockyFord
RockyFord

Reputation: 8519

The default ZF .htaccess will not serve .php files other then index.php from the public folder so move that .php file out of the public space.

Put it in application/configs or someplace similar.

You could probably modify your .htaccess to allow just that one .php file to be served but you really don't want arbitrary .php files in the public space on your server.

Upvotes: 0

Related Questions