I usually use a placeholder/partial directly in the view script for things
like this. In fact i never even thought to go abotu it in the way you are
doing.
so in my layout.phtml i might have something like:
<?php echo $this->placeholder('sidebar'); ?>
and in my index.phtml i would have:
<?php $this->placeholder('sidebar')->set($this->partial('sidebar.phtml'));
?>
Or if i needed logic to compile my data for use in the sidebar.phtml then i
might the action view helper instead of the partial.
Gabriel Malkas-2 wrote:
>
> Hi,
>
> I use Zend_Layout and I need to render a different 'navbar' accordingly to
> the active action. I simply wrote this in my layout.phtml file :
>
> <?php echo $this->layout()->sidebar; ?>
>
> Then, in every action that needs to display a sidebar, I have :
> $this->render('sidebar', 'sidebar');
>
> This works since it renders the sidebar.phtml script, but it doesn't
> render
> the action-name.phtml script anymore. It's possible to render both scripts
> but I have to add a line :
> $this->render('sidebar', 'sidebar');
> $this->render('index', 'default');
>
> Now this does exactly what I need, but it's cumbersome since the action's
> script "should" be rendered automatically anyway. Is it possible ?
>
> Is there a better way to achieve that ?
>
> Thanks.
> Regards,
> Gabriel.
>
>
--
View this message in context:
http://old.nabble.com/Zend_Layout-and-view-rendering-tp26359008p26389939.html
Sent from the Zend Framework mailing list archive at Nabble.com.