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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-16-2007, 04:18 AM
Junior Member
 
Join Date: Jun 2007
Posts: 4
Default same header and footer on every page

hi all

basically, what i did previously was, extend the Zend_View class
and have a display method that would do the following
PHP Code:
// just assume the variables are initiated somewhere else
class MY_View extends Zend_View {
 public function 
display() {
  
$this->render($header);
  
$this->render($body);
  
$this->render($footer);
 }
}

class 
IndexController extends Zend_Controller_Action {
 public function 
indexAction() {
  
$view = new My_View();
  
$view->display();
 }

i'd call the display method from inside the Controller action method
this would save me having to put the same include or render method into all of my templates

with the release of zf 1.0rc1, i wanted to try using the ViewRenderer method of rendering views
but i haven't worked out how to make it automatically render the header and footer, i have followed the example to put all my controllers and views into the standard directory structure

any advice
thanks
dave

Last edited by dtra : 06-16-2007 at 04:21 AM. Reason: add code
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-16-2007, 06:29 AM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 121
Default

There are several ways to do this, one is the two step view pattern and the other is a proposed Zend Framework Layout component. The two step view method was described on Maugrim The Reaper's Blog and information about the proposed Zend_Layout can be found on #zftalk (irc://irc.freenode.net/zftalk) where ralphschindler(proposal author) lurks. Zend_Layout does exactly what you want, but it is not an official ZF component just yet... We are hoping it will be included in the next release.
__________________
Zym Framework - A Zend Framework extension library w/ demo app

SpotSec Blog:
http://spotsec.com/blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-17-2007, 01:01 AM
Junior Member
 
Join Date: Jun 2007
Posts: 4
Default

ah ok
i might check out that layout component then, and perhaps wait and see what happens with that
before deciding which way to go

thanks
dave
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 10:25 AM.