2010年9月27日星期一

Re: [fw-mvc] Included layouts

I agree with Christian. I often use partials or separate view scripts (using
$this->render()) for common elements that are shared between layouts. You
can also use placeholders. It all depends on which functionality you need.

--
*Hector Virgen*
Sr. Web Developer
Walt Disney Parks and Resorts Online
http://www.virgentech.com

On Mon, Sep 27, 2010 at 9:45 AM, Christian Heinrich <
christian@gladbachcity.de> wrote:

> Hi,
>
> you can easily render viewscripts via
>
> <?php echo $this->render('viewscript.phtml'); ?>
>
> Maybe this helps?
>
> Regards
> Christian
>
> Hello,
>>
>> I'm working on a ZF-based application, and I've a problem... I'm using a
>> layout to define my header/footer and a view printed using
>> "echo $this->layout()->content".
>>
>> The problem is that in a controller, each page have the same structure and
>> I want to create a layout for them. I can create a new layout but in its I
>> have to write again my header/footer declarations, and I don't want because
>> if I have to change one link, I will have to change in the both layouts.
>>
>> So, my question is: is it possible to create a layout name "my_controller"
>> within I'll user "echo $this->layout()->content" and my view will be printed
>> in, and that my new layout takes place of the view in my main "layout"
>> layout?
>>
>> These files will be used to generate HTML of my pages:
>> layouts/layout.phtml > layouts/my_controller.phtml > views/my_action.phtml
>>
>> Is it possible? If not, is it possible with another way?
>>
>> Best regards,
>> Samuel ROZE.
>>
>>
>
>

没有评论: