Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2008, 02:21 PM
Junior Member
 
Join Date: Mar 2008
Posts: 12
Default partial views and modular directory structures

I am using the modular directory structure where you simply call $front->addModuleDirectory ('../application/modules') and each module has its own directory under that (as shown in the documentation). However, I have partial views that are used by all of the modules. I didn't want to copy the partial views into every module, so I created a separate directory called partial_views at the same level as the modules directory and I call echo $this->partial ('../../../../partial_views/some_partial_view.phtml') from my view scripts. I am just wondering if anyone has come up with a more elegant way of doing this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 12:51 AM
lucasm's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Águas Claras-DF, Brazil
Posts: 17
Lightbulb

Sawatdee,

Did you ever hear about Zend_Layout? I think this could the answer for you.
I'm newbie at all but I guess this is a way to manage a lot of recurring code in the application's presentation.

I suggest the reading:
(*) post edited, I added two more links I've just found.

regards,
__________________
Lucas Mauricio C. e Martins
CR Vasco da Gama, my biggest passion!

Ajude a Combater o Spam! - Help fighting spam!

Last edited by lucasm : 04-07-2008 at 01:33 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-07-2008, 12:57 PM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

Quote:
Originally Posted by sawatdee View Post
I am just wondering if anyone has come up with a more elegant way of doing this.
views in the default module will be loaded if the view can't be found in the current module.

Root
  • controllers
  • views
  • modules
    • mymodule
      • controllers
      • views

Using the above structure views placed in the second folder (views) could be loaded from any module.

To make it work you have to pass 'default', pointing to the controllers folder (folder1), to $controller->setControllerDirectory.

After that you can call $this->partial ('some_partial_view.phtml') without the path.

Hope this helps.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:27 AM.