Hi Mike - will that only render to placeholders within the layout script, or
can I persuade it to render to placeholders within index.phtml somehow?

Yours,
Mark



Mike Wright-4 wrote:
> 
> lightflowmark wrote:
>> Hi,
>> I'm trying to achieve the following and having real difficulty in seeing
>> how
>> it should work:
>> 
>> 1)  have a global layout using Zend_Layout which renders some
>> common-to-all-actions stuff - a header, a menu, a footer.  The 'main
>> action'
>> is then rendered to layout()->content.
>> 2)  have the 'main action' render some widget actions to placeholders
>> within
>> its view script.
>> 
>> So if I have the following
>> IndexController:
>>         menuAction
>>         headerAction
>>         indexAction
>>         widgetAction
>>         anotherWidgetAction
>> 
>> layout.phtml:
>>     <?= $this->layout()->header ?>
>>     <?= $this->layout()->menu ?>
>>     <?= $this->layout()->content ?>
>> 
>> 
>> index.phtml:
>>     <? //I want widgetAction content rendered here ?>
>> 
>>     <? //I want anotherWidgetAction content rendered here ?>
>> 
>> 
>> 
>> When I go to /index/index, menuAction and headerAction are called by the
>> ActionStack and rendered at the appropriate placeholders in layout.phtml
>> by
>> Zend_Layout.  
>> 
>> Then I want indexAction to call widgetAction and anotherWidgetAction and
>> render them to placeholders within index.phtml.
>> 
>> 
>> 
>> What is the best way of achieving this?  I am adding widgetAction &
>> anotherWidgetAction to the ActionStack in indexAction, but how do I
>> render
>> them to placeholders in index.phtml?
> 
> Hi Mark,
> 
> You're on the right track.
> 
> In your layout:
> <?= $this->layout()->widget ?>
> 
> In your index controller:
> $this->render('widget', 'widget');
> 
> This will cause the views/scripts/index/widget.phtml script to be 
> rendered into the segment with the same name in the layout.  Note that 
> the segment's name need not be the same as the script's name.
> 
> hth,
> Mike Wright
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Layout-for-individual-actions--tp23356760p23390743.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to