Elegant way to reuse/nest views in Zend Framework?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Elegant way to reuse/nest views in Zend Framework?

Post by Begby »

I have just started getting into Zend Framework for a big project and I am not seeing a convenient way to use views, or maybe the view system isn't that great yet.


Say I have a header, a footer, then a menu that only shows up if someone is logged in, and I want to display the logged in persons name.


Is there a way I can set the logged in name without having to do it in every controller?

Is there a way I can create a root template, then take the output of the action controller and shove it into a variable in the middle of that root template without having to render the header/footer/and menu in every controller?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

This thread goes into extensive detail about extending Zend's view and more advanced (composite) views. I found it very helpful.

viewtopic.php?t=66007&highlight=pet+shop
Begby
Forum Regular
Posts: 575
Joined: Wed Dec 13, 2006 10:28 am

Post by Begby »

Thank you, I will read through that whole thread, looks good.
Post Reply