Hi
Not really gone into this in too much detail but in your layout you could
try -
<?= $this->action('actionName', 'controllerName') ?>
Also, I use to do a similar thing and put all my widgets in an action. But I
hated this approach because under the standard routing, if you go to say
http://mysite.com/controller/action and this is one of your widgets, you can
end up with the widget displaying twice on the page. So I spent ages working
on a custom routing to solve this. I also learned very recently that by
putting your widgets into controller actions you can slow down your pages.
This article explains it better than I can -
http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/
And as a results, I've since moved all my widgets into my own custom view
helpers, as well as ditching my standard routing, and the results are
impressive. And because a view helper is allowed to read from a model, it
means you can keep your models doing all the logic of your application, and
your helpers can just use this information and render it to your liking.
lightflowmark wrote:
>
> Hi,
> I'm trying to create a clean, widgetized page using Zend_Layout &
> ActionStack. I have a global layout.phtml file with placeholders like
> <?= $this->layout()->menu ?>,
> <?= $this->layout()->content ?>,
> and am adding the menu action to the ActionStack in a controller plugin
> from dispatchLoopStartup. In the menu action I am assigning it to the
> placeholder like
> $this->_helper->viewRenderer->setResponseSegment('menu')
>
> All this is working just fine - really easy & clean.
>
> But now I want to have a similar system within my controller actions. Say
> I have a primary action I'm trying to view - myPageAction. My current
> implementation handles showing the menu and other things, but within
> myPageAction I want to render content from myWidgetAction and
> myOtherWidgetAction. So I push these actions to the actionstack within
> myPageAction - but how do I render them in placeholders within
> my-page.phtml?
>
> Code like <?= $this->layout()->menu ?> or <?= $this->layout()->myWidget ?>
> doesn't render anything within the context of my-page.phtml - does anyone
> have any insight into how to construct this code?
>
> There's a lot of posts on the forum about this, but I can't find anything
> that explains it in sufficient detail for me to follow - I'm fairly sure
> Matthew answers the question in
> http://www.nabble.com/global-layout----controller-layout-td18401027.html#a18401027
> but I can't flesh out his reply sufficiently to code it up!
>
> Any insight appreciated.
>
> Yours,
> Mark
>
--
View this message in context:
http://www.nabble.com/Another-Zend_Layout-question-tp22663886p22668839.html
Sent from the Zend Framework mailing list archive at Nabble.com.