<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Why the Zend Framework Actionstack is Evil</title>
	<atom:link href="http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/</link>
	<description>Randomness will get you everywhere.</description>
	<lastBuildDate>Mon, 30 Aug 2010 22:02:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Jake Noble</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-674</link>
		<dc:creator>Jake Noble</dc:creator>
		<pubDate>Sat, 21 Aug 2010 14:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-674</guid>
		<description>Great article. Negative, but well explained and completely justified!</description>
		<content:encoded><![CDATA[<p>Great article. Negative, but well explained and completely justified!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-672</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Wed, 11 Aug 2010 20:44:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-672</guid>
		<description>Actually, there are plenty of better ways to achieve this, and I would say that the actionstack is about the worst. All you are suggesting, is that you put all the presentation logic (which blocks to render where) into your controller.

That logic of deciding which blocks to place where belongs squarely in the view, and not in your controller.
If each block  (or widget) needs its own configuration, it is perfectly acceptable within MVC for the view to fetch this directly from the model, no need for a controller just for that. 

Remember, your controller is for steering your request, NOT for deciding how things should look.</description>
		<content:encoded><![CDATA[<p>Actually, there are plenty of better ways to achieve this, and I would say that the actionstack is about the worst. All you are suggesting, is that you put all the presentation logic (which blocks to render where) into your controller.</p>
<p>That logic of deciding which blocks to place where belongs squarely in the view, and not in your controller.<br />
If each block  (or widget) needs its own configuration, it is perfectly acceptable within MVC for the view to fetch this directly from the model, no need for a controller just for that. </p>
<p>Remember, your controller is for steering your request, NOT for deciding how things should look.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mangled</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-670</link>
		<dc:creator>Mangled</dc:creator>
		<pubDate>Wed, 11 Aug 2010 08:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-670</guid>
		<description>View helpers are great. It&#039;s great to have a NewsController and be able to have some lightweight view helpers to be able to render some breadcrumbs, a menu or a shopping cart.

But what if you have fully dynamic pages, loaded from a database? Where there is no NewsController, because &quot;news&quot; is just one of the widgets that can be placed on a page? What if every widget has it own request parameters/configurations, differing from page to page? What if you want every widget in an individual directory, with it&#039;s own models and views?

Currently, Zend Framework has no better way than to achieve this with routes to some IndexController, or &quot;PageController&quot;, and the actionstack to execute each widget, one by one, until the page is fully built.</description>
		<content:encoded><![CDATA[<p>View helpers are great. It&#8217;s great to have a NewsController and be able to have some lightweight view helpers to be able to render some breadcrumbs, a menu or a shopping cart.</p>
<p>But what if you have fully dynamic pages, loaded from a database? Where there is no NewsController, because &#8220;news&#8221; is just one of the widgets that can be placed on a page? What if every widget has it own request parameters/configurations, differing from page to page? What if you want every widget in an individual directory, with it&#8217;s own models and views?</p>
<p>Currently, Zend Framework has no better way than to achieve this with routes to some IndexController, or &#8220;PageController&#8221;, and the actionstack to execute each widget, one by one, until the page is fully built.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-559</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 15 Apr 2010 09:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-559</guid>
		<description>So you advise to use an MVC pull approach ?</description>
		<content:encoded><![CDATA[<p>So you advise to use an MVC pull approach ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-535</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 18 Feb 2010 19:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-535</guid>
		<description>Dan: Sorry, the action view helper does much more than this, it grabs the request, and dispatcher from the front controller, and clones them, then dispatches a whole new request to run the actual action your asking for. its a terrible waste! (and will include a layout if your not careful)</description>
		<content:encoded><![CDATA[<p>Dan: Sorry, the action view helper does much more than this, it grabs the request, and dispatcher from the front controller, and clones them, then dispatches a whole new request to run the actual action your asking for. its a terrible waste! (and will include a layout if your not careful)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Moore</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-490</link>
		<dc:creator>Dan Moore</dc:creator>
		<pubDate>Tue, 02 Feb 2010 02:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-490</guid>
		<description>I&#039;m a noob to Zend, is the Action View Helper the thing that takes controller/action and finds the corresponding view script in the views directory and echoes it? (or includes it in the site wide layout as -&gt;content)</description>
		<content:encoded><![CDATA[<p>I&#8217;m a noob to Zend, is the Action View Helper the thing that takes controller/action and finds the corresponding view script in the views directory and echoes it? (or includes it in the site wide layout as -&gt;content)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Mauger</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-419</link>
		<dc:creator>Ryan Mauger</dc:creator>
		<pubDate>Wed, 16 Dec 2009 09:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-419</guid>
		<description>Actually Christian, There are far more solutions that the three you outlined, and the three you have, are pretty terrible imo.
An action should actually *do* something useful. The thought of using an action just to fill one small chunk of a page makes me shudder at best.
To make widgetised content the best solution is by far to create a view helper for each widget, which can then render a partial after passing it content from the db. this gives the nice seperation of concerns, while avoiding having the dispatch loop bounce around creating masses of extra opportunities for bugs, making it hard to see the execution flow directly, and loads of extra overhead.
Also note, if you need a different template for each page, you are working very inefficiently. You should be able to manage your articles to be displayed on a particular page without the need of a template for each permutation, and it should also be possible to do this without hardcoding this into the template. Infact I would go so far as to say that if you require this many templates for your pages, then you have simply hardcodeded this elsewhere, shifting it, rather than eliminating it.</description>
		<content:encoded><![CDATA[<p>Actually Christian, There are far more solutions that the three you outlined, and the three you have, are pretty terrible imo.<br />
An action should actually *do* something useful. The thought of using an action just to fill one small chunk of a page makes me shudder at best.<br />
To make widgetised content the best solution is by far to create a view helper for each widget, which can then render a partial after passing it content from the db. this gives the nice seperation of concerns, while avoiding having the dispatch loop bounce around creating masses of extra opportunities for bugs, making it hard to see the execution flow directly, and loads of extra overhead.<br />
Also note, if you need a different template for each page, you are working very inefficiently. You should be able to manage your articles to be displayed on a particular page without the need of a template for each permutation, and it should also be possible to do this without hardcoding this into the template. Infact I would go so far as to say that if you require this many templates for your pages, then you have simply hardcodeded this elsewhere, shifting it, rather than eliminating it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tehla</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-415</link>
		<dc:creator>Tehla</dc:creator>
		<pubDate>Wed, 09 Dec 2009 21:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-415</guid>
		<description>Hi, 

Thanks for your comments Christian, but what do you mean by &quot;the layout is controlled via configuration&quot; ? An .ini file ? Where do these settings (?) come from ?

I&#039; m a beginer in ZF, and I &#039;m looking for the best way to use ZF with on multi-widget site. And especially by ActionStack ^^</description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>Thanks for your comments Christian, but what do you mean by &#8220;the layout is controlled via configuration&#8221; ? An .ini file ? Where do these settings (?) come from ?</p>
<p>I&#8217; m a beginer in ZF, and I &#8216;m looking for the best way to use ZF with on multi-widget site. And especially by ActionStack ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-413</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 04 Dec 2009 09:58:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-413</guid>
		<description>I know this post is quite old, but I stumbled on this discussion when solving an ActionStack issue.

I agree with the ActionHelper but I totally disagree regarding the ActionStack. If you are developing reusable components like mentioned in some earlier posts the ActionStack is an essential part of it. Why?

Let&#039;s think of a simple action &quot;listArticles&quot; and of a webpage consisting of 50+ pages where on each page a specific set of articles is to be displayed. The action itself may parameterized by: the number of articles to display, the category where the articles originate from and so on...

Now, you end up with the situation, that you need to define *somewhere* which articles to display on a requested page and *where* on the page.

There are several solutions:

(1) Have one pageAction which is always called for rendering a page. The pageAction reads the configuration of the page from e.g. an xml file or from database

(2) Have a PageController Plugin which hooks into routeShutdown() and builds up an *ActionStack* from an xml file or database

(3) Have an action for each concrete page (pretty bad idea)

In case (1) the &quot;pageAction&quot; would compile a concrete view template for the requested page - one for each page - as each page looks different in our case. Each view template would consist of one or several partials that query directly on the model. Now, you have the logical part of &quot;what model data to display&quot; in a view template?? Even if you parameterize the partial via view variables you still &quot;hard code&quot; that you want do display articles at exactly this position in the view script. Of course, if you work with Zend_Layout, you may alter the position, but still the logic of &quot;what to display&quot; is hard coded in the page template (and it&#039;s one out of 50 templates if you remember)

(2) If you work with a plugin that makes use of the Action Stack you work completely view independent. At routeShutdown() you can compile (via xml or db) a set of actions to render for this concrete page (e.g. 3 x list articles, 1 x navigation, 1 x newsletter subscription, ...) - each with different parameters of course. In this case, an action is seen as an reusable component - reusable within a page and reusable on several pages. You can even load the position (layout target) and the to-be-used template via configuration. For the listArticlesAction you may have several templates to choose from: simple / extended / blogstyle - but all this is controlled via configuration, not in a controller or a view partial. Further more, you can specify the layout target when using Zend_Layout. This way it&#039;s possible to render an action and it&#039;s view into a specific position defined only via configuration.

(3) I won&#039;t argue on that one :)

Feel free to comment on these thoughts - maybe I couldn&#039;t state my point clearly. An example which is build upon (2) is our financial portal: http://www.godmode-trader.de/

Obviously, the &quot;PageController&quot; concept collides with a simple MVC setup in this case. I would be happy about any other suggestions how to solve such requirements efficiently with Zend_MVC.</description>
		<content:encoded><![CDATA[<p>I know this post is quite old, but I stumbled on this discussion when solving an ActionStack issue.</p>
<p>I agree with the ActionHelper but I totally disagree regarding the ActionStack. If you are developing reusable components like mentioned in some earlier posts the ActionStack is an essential part of it. Why?</p>
<p>Let&#8217;s think of a simple action &#8220;listArticles&#8221; and of a webpage consisting of 50+ pages where on each page a specific set of articles is to be displayed. The action itself may parameterized by: the number of articles to display, the category where the articles originate from and so on&#8230;</p>
<p>Now, you end up with the situation, that you need to define *somewhere* which articles to display on a requested page and *where* on the page.</p>
<p>There are several solutions:</p>
<p>(1) Have one pageAction which is always called for rendering a page. The pageAction reads the configuration of the page from e.g. an xml file or from database</p>
<p>(2) Have a PageController Plugin which hooks into routeShutdown() and builds up an *ActionStack* from an xml file or database</p>
<p>(3) Have an action for each concrete page (pretty bad idea)</p>
<p>In case (1) the &#8220;pageAction&#8221; would compile a concrete view template for the requested page &#8211; one for each page &#8211; as each page looks different in our case. Each view template would consist of one or several partials that query directly on the model. Now, you have the logical part of &#8220;what model data to display&#8221; in a view template?? Even if you parameterize the partial via view variables you still &#8220;hard code&#8221; that you want do display articles at exactly this position in the view script. Of course, if you work with Zend_Layout, you may alter the position, but still the logic of &#8220;what to display&#8221; is hard coded in the page template (and it&#8217;s one out of 50 templates if you remember)</p>
<p>(2) If you work with a plugin that makes use of the Action Stack you work completely view independent. At routeShutdown() you can compile (via xml or db) a set of actions to render for this concrete page (e.g. 3 x list articles, 1 x navigation, 1 x newsletter subscription, &#8230;) &#8211; each with different parameters of course. In this case, an action is seen as an reusable component &#8211; reusable within a page and reusable on several pages. You can even load the position (layout target) and the to-be-used template via configuration. For the listArticlesAction you may have several templates to choose from: simple / extended / blogstyle &#8211; but all this is controlled via configuration, not in a controller or a view partial. Further more, you can specify the layout target when using Zend_Layout. This way it&#8217;s possible to render an action and it&#8217;s view into a specific position defined only via configuration.</p>
<p>(3) I won&#8217;t argue on that one <img src='http://www.rmauger.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Feel free to comment on these thoughts &#8211; maybe I couldn&#8217;t state my point clearly. An example which is build upon (2) is our financial portal: <a href="http://www.godmode-trader.de/" rel="nofollow">http://www.godmode-trader.de/</a></p>
<p>Obviously, the &#8220;PageController&#8221; concept collides with a simple MVC setup in this case. I would be happy about any other suggestions how to solve such requirements efficiently with Zend_MVC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RiotRick</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-390</link>
		<dc:creator>RiotRick</dc:creator>
		<pubDate>Fri, 09 Oct 2009 15:19:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-390</guid>
		<description>Indeed actionstack is not evil. It is extremely useful in certain applications. 

Basically we have done something similar as in reply #14.

Divided a page into seperate blocks (using Zend_Layout). Each block can display content which is provided by a content provider module. This content provider module is created as a module in ZF with it&#039;s own MVC structure. 

So basically this way we can create independent modules with their own mvc structure, which can be shared among different websites. 

We can add different modules to different layout blocks on the page. 

In order to run and render all these blocks we loop through all defined blocks on a page and run the linked module/controller/action with the action stack. 

Sure this will give a bit overhead, but it makes life a lot easier in developing seperate re-usable content modules.</description>
		<content:encoded><![CDATA[<p>Indeed actionstack is not evil. It is extremely useful in certain applications. </p>
<p>Basically we have done something similar as in reply #14.</p>
<p>Divided a page into seperate blocks (using Zend_Layout). Each block can display content which is provided by a content provider module. This content provider module is created as a module in ZF with it&#8217;s own MVC structure. </p>
<p>So basically this way we can create independent modules with their own mvc structure, which can be shared among different websites. </p>
<p>We can add different modules to different layout blocks on the page. </p>
<p>In order to run and render all these blocks we loop through all defined blocks on a page and run the linked module/controller/action with the action stack. </p>
<p>Sure this will give a bit overhead, but it makes life a lot easier in developing seperate re-usable content modules.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
