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?

Answers


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:

$this->getResource('layout')->setLayout('admin');

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.


Need Your Help

A perfect hash for known values

c hash

Say I have some known values, against which I want to create a hash table. For example,

REST web services, just for database access only?

rest post get service

I've been reading up on REST web services and would like to implement a rest service of my own.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.