Different modules using subdir links with a global layout?
I need a modular design for new version of my web application project which I'm planning to design like this:
foo.com/baz ---> baz module
foo.com/bar ---> bar module
foo.com/admin ---> admin module and so on...
I'm asked to design it with a single layout which will have a navigation on top and that will change the highlighted link for active module. But for admin module, I need a different layout. Also, all these modules will use static files, like images, js, and css files from a foo.com/static folder.
Is there a quick and appropriate way to design this structure without using URL routing?
You should be able to use your example routing by default. Check out the docs on modules. You should be able to use a module bootstrap to change the layout for your admin module:
You may even be able to use a module specific configuration (not certian about this):
resources.layout.layout = "layout" admin.resources.layout.layout = "admin"
Highlighting the link of the active page is pretty trivial:
<?php $active = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();?> <div> <?php foreach($modules as $module => $display): ?> <span class='tab<?if($module == $active):?> highlight<?php endif; >?'> <a href='<?php echo $this->url(array('module' => $module))?>'> <?php echo $display; ?> </a> </span> <?php endforeach; ?> </div>
Or you could use Zend_Navigation, which allows generating navigation based on modules/controllers/actions.