Depending on the APPLICATION_ID my website adds different statict content
from a specific module.

F.e. APPLICATION_ID 1 catches content from /modules/content1 etc.

I would like to always call the static contents via
www.mydomain.de/content/foo.

I tried around using a plugin but I always get a Invalid controller
specified (content) message.

My structure:
/modules/default
/modules/content1
/modules/content2

My plugin:

<?php
class Plugin_Content extends Zend_Controller_Plugin_Abstract
{
    public function dispatchLoopStartup(Zend_Controller_Request_Abstract
$request)
    {
        if (APPLICATION_ID === 1) {
                $autoloader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => 'Content1_',
                    'basePath'  => APPLICATION_PATH . '/modules/content1'
                ));

                $frontController = Zend_Controller_Front::getInstance();
            $frontController->addControllerDirectory(
                APPLICATION_PATH . '/modules/content1/controllers',
                'content'
            );

            $router = $frontController->getRouter();
                $router->addRoute(
                    'content',
                    new
Zend_Controller_Router_Route(':module/:controller/:action/*',
                        array(
                            'module' => 'content1'
                        )
                    )
                );
        }
    }
}


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Dynamically-routing-a-module-to-different-controllers-tp3582673p3582673.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to