I think what you are touching on is an advanced use case. It seems like you
want sub-layouts, or per-module layouts. This is actually a use case that
influenced the design of Zend_Layout.
I do not have code, but I could point you in the right direction to handle
your problem. Instead of using Zend_Layout::startMvc(), you would create
your own controller plugin, and utilize your own layout object -
$this->_subLayout = new Zend_Layout(...);
Then, inside your plugins postDispatch(), you might wrap certain modules
responses with your sub-layout content; after all Zend_Layout is a view
decorator.
You would still have your global Zend_Layout mvc instance doing its thing,
but this would allow you to have module specific layouts.
Hope this helps,
Ralph
On 9/23/08 11:26 AM, "dele454" <[EMAIL PROTECTED]> wrote:
>
> Hi Mark,
>
> Thanks for the response. Am not confusing views with layouts. The files in
> the structure i specfied are just for illustrative purposes. I have both my
> partials and layouts in different folders - just for less confusion for me.
> What i decided to do is to move the layout folder to the root and have all
> my layouts for both the CMS and Main site in there. so the structure now
> becomes:
>
> - webapp
> --> public_html
> ---> images
> ---> bla blah
>
> --->controllers
> --->views
> --->layouts
> --->layout.phtml
> --->layout-browse.phtml
> --->partials
>
> -->modules
> --->admin
> --->controllers
> --->views
>
>
>
> MarkDNA wrote:
>>
>> I have something similar to that, but I'm not using the layout paths - I'm
>> just dropping the layout into the views/scripts/ dir for each module, and
>> for the main site (login screen in my case). You might just have to give
>> it a try to see what your results are. You can set layouts in the
>> controllers with:
>>
>> $this->_helper->layout->setLayout('foobaz');
>>
>> Looking at the names for your layouts, I hope you aren't confusing layouts
>> with views. A view for your browse action and one for your edit action can
>> use the same layout if you want. In a layout file you use
>> $this->layout()->content to display the view for your controller action.
>> So if you have an editAction() in you controller, $this->layout()->content
>> will display edit.phtml where you place it in the layout. You use the
>> views to include headers, navs, and footers mostly. Sorry if I'm off-base
>> and you know this already!
>>
>> -Mark
>>
>>
>> dele454 wrote:
>>>
>>> Hi Mark,
>>>
>>> Thanks for the response. So what you are saying is that as long as i keep
>>> the startMvc() empty and specify my module paths, ZF will always look
>>> for the layout.phtml files within the specified module directories?
>>>
>>> In my scenario, i just have one module:admin module - where the cms apps
>>> reside. But the main site just resides on the app root folder. For better
>>> understanding here is my folder structure:
>>>
>>> - webapp
>>> --> public_html
>>> ---> images
>>> ---> bla blah
>>>
>>> --->controllers
>>> --->views
>>> --->layouts
>>> --->layout.phtml
>>> --->layout-browse.phtml
>>> -->modules
>>> --->admin
>>> --->controllers
>>> --->views
>>> --->layouts
>>> --->layout.phtml
>>> --->layout-edit-mode.phtml
>>>
>>> Like i said before i simply want to keep the layout of my CMS separate
>>> from that of the main site. The main site isnt a module. So what would
>>> my startMvc() look like then with my folder structure in mind.
>>>
>>> In my bootstrap i have something like this at the moment:
>>>
>>> Zend_Layout::startMvc(array(
>>> 'layoutPath' => $config->paths->data
>>> . '/module/admin/views/layouts');
>>>
>>> I need to include that path layout path for the main site.
>>>
>>> Thanks
>>>
>>
>>
>
>
> -----
> dee
--
Ralph Schindler
Software Engineer | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/