On 8 Jan 2009, at 11:32, Pádraic Brady wrote:


Another option for the common users' data is to simple create a View Helper which runs the relevant query to get the total user count (have the helper grab the Model instance and perform the work). Then simply call that View Helper from within your template as needed. Just to be smart, you can use
the same helper if its really really needed within a Controller using
$this->view->myHelper().

The reason an Action Helper for that case may be inappropriate, is that the data is needed by the View, but is not needed by the Controller, so why even
bother doing it in the Controller? ;) Skip the middleman.

Yeah for this case, an view helper make life so much easier and makes more sense.

In general it's a good idea to avoid extending Zend_Controller_Action to add functionality. It's the easy option, and like all similarly easy options it
can turn into a bloated, overused, unportable class.

I agree - the main problem is when you need two unrelated types of functionality and then your "simple" parent class suddenly becomes a God :)

Regards,

Rob...

Reply via email to