Please reply to the list.

On Monday 13 July 2009 08:22:15 Sergio Rinaudo wrote:
> Hi,
> thank for your answer.
> I've already tried to use a parameter to disable the layout, but using this
> method also the main layout will be disabled.

Can you paste your code here, somebody will surely be able to figure it out. 
:)

> Do you know where can I see the widget view helper that you are talking
> about? Does it bring performance issue?

There isn't really an example, but let me explain:

if you have a need for the same kind of view logic in multiple places (an, by 
what you're trying to do, you have), a view helper to extract the logic is a 
good approach. Basically, a very rough example:

/controller/action1:
        $this->content = $model->getMyWidgetStuff();
        $this->sidebar = $model->getMyOtherStuff();

(now in view):
<?php echo $this->contentRender($this->content); ?>
<?php echo $this->widgetRender($this->sidebar); ?>



/controller/action2:
        // notice different model calls (different data being displayed)
        $this->content = $model->getMyNewStuff();
        $this->sidebar = $model->getMyWidgetStuff();

(now in view):
<?php echo $this->contentRender($this->content); ?>
<?php echo $this->widgetRender($this->sidebar); ?>

You create an abstract enough view helper (or helpers) and bind data to them 
inside the controller.

>
> Thanks
>
> Sergio Rinaudo
>
> > From: d...@krizevci.info
> > To: fw-general@lists.zend.com
> > Date: Mon, 13 Jul 2009 09:17:44 +0200
> > Subject: Re: [fw-general] FW: Using 'action' view helper
> >
> > On Monday 13 July 2009 04:52:56 Sergio Rinaudo wrote:
> > > Hi,
> > > I want to use the 'action' view helper ( $this->action([..]) ) to
> > > widgetize some content of a certain request. My problem is that I get
> > > the whole layout, not just the content I need.
> > >
> > > What shoul I do to render only the content of an action?
> > > Thanks
> >
> > You really shouldn't do it like that as action() helper comes with a
> > performance penalty, this' been discussed on this list already. You could
> > make view helpers for "widget" sort of thing.
> >
> > But, to answer your question, you can set an additional param (say,
> > noLayout: true) in your action() call, check for that param inside the
> > action and, if set, disable the layout.
> >
> > --
> > Dado
>
> _________________________________________________________________
> Naviga al sicuro, usa Windows Live Messenger!
> http://messenger.it/home_sicurezza.aspx

-- 
Dado

Reply via email to