Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2008, 06:18 PM
Junior Member
 
Join Date: Mar 2008
Posts: 12
Default rendering a view within a view

Is there a way to store a view in a phtml file and then render it as part of another view? For example, if I have a menu or footer that is common to all of the pages on my site and I want to keep it in one phtml file so that I can change it in one place and it will change everywhere. I can't find anything about doing this in the documentation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-09-2008, 01:17 AM
Junior Member
 
Join Date: Mar 2008
Posts: 6
Default

Sure, you just need to call the render method in your view script file like this:
PHP Code:
<?php echo $this->render('header.phtml'); ?>
Although, I'd advise that you look into the Zend_Layout library as this implements the 2 step design methodology. You'll quickly find that you'd prefer to do things this way if you start to realise that you're including headers and footers in every view in your application.

More info here: Zend Framework: Documentation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-10-2008, 03:36 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 112
Default

Also, outside of Zend_Layout is the Partial helper for Zend_View. So if you need other repeatable elements that isn't apart of your site wide template (layout), then partials are the way to go: Zend Framework: Documentation: Zend_View (Scroll down to this section: 41.4.1.2. Partial Helper)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:16 PM.