Introducing Zend View Helpers
February 25th, 2009This video covers how to setup and user Zend View Helpers. I also cover how state is managed within the class. Next week I’ll show you how you can use this technique with a bit of AJAX to make those View Helpers shine! I’ll post the project code for both videos with part 2.

Your article is very usefulness. Can you please post some additional information about this? take care
Hi,
very very well done webcasts. Love them.
Im struggling with a problem though:
I have a helper that should show the usual “Welcome Guest!” or “Logged in as [user]” in my application. The problem is that I need to pass the identity object to the helper before it is being used in the layout. In other words, I have no idea how to “initialize” my helper so that it knows who is or is not currently logged in.
Thanks a bunch.
I’ll be glad to know the answer.
Hi Slavic, I think a singleton strategy would work for this, where you create a class that “owns” that little bit of data. Ideally it would be connected to Zend_Acl and you could just query Zend_Acl’s methods to get the answer for who’s logged in. I did an example like this a couple months back. Hope that helps!
Hi Jon,
thanks – I don’t yet use Zend_Acl, I use only Zend_Auth so i might need to read first about the acl features.
However, I fixed my problem by accessing Zend_Auth in the very view helper class, which I think is pretty much what you meant.
Thanks again.
Hey jon!
Can you explain why are you not putting helper files under application/views/helpers?
I tried to follow you with that folder structure, but just ended up with bunch of errors.
I ended up puting Notice.php in application/views/helpers folder and calling that class Zend_View_Helper_Notice and i managed to get everything to work.
Thanks for these screencasts!