> Maybe it's wrong approach - but what i wanna achive is to somehow run > certain VIEW script with certain controller action. With this part I meant I had in mind to use same Controller-Action on few different templates (like if I have different headers/footers)
Thank you, I'll give it a test in practice. Matthew Weier O'Phinney-3 wrote: > > -- agatone <[EMAIL PROTECTED]> wrote > (on Thursday, 23 August 2007, 09:58 AM -0700): >> Since I wanna have header, footer, menu includes etc. and I notice quite >> few >> problems and posts around it. >> I found that view script can be included nicely inside other view script >> (can say news) with <?php echo $this->render('index/header.phtml') ?> >> >> This is quite what i need(not completly), because i can also assign some >> variables that are in header.phtml directly from current running action - >> listAction. >> >> I made also controller _Include_HeaderController with one action Index >> which >> should assign all that common variables inside header.phtml (if user is >> logged - his name, date etc.) >> >> But now i don't know how to run that header controller action inside my >> news >> action so it would normaly assign view variables. > > Don't do this. Use an action helper or a preDispatch() plugin instead to > do the injection. For instance, you could have an action helper like > this one: > > class My_Helper_Header extends Zend_Controller_Action_Helper_Abstract > { > public function preDispatch() > { > $this->direct(); > } > > public function direct() > { > $view = > Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view; > $view->header_meta = '...'; > $view->header_css = '...'; > // etc. > } > } > > Then, in your bootstrap: > > Zend_Controller_Action_HelperBroker::addHelper(new > My_Helper_Header()); > > The point being, this will do it automatically for you, and doesn't > require dispatching another controller action. > >> Maybe it's wrong approach - but what i wanna achive is to somehow run >> certain VIEW script with certain controller action. > > That can be done already; the ViewRenderer, which is on by default, > automatically renders the view script <controller>/<action>.phtml. > > BTW, what you're trying to do will be addressed for 1.1.0 with the > addition of placeholders and layout support. > > -- > Matthew Weier O'Phinney > PHP Developer | [EMAIL PROTECTED] > Zend - The PHP Company | http://www.zend.com/ > > -- View this message in context: http://www.nabble.com/Controller-called-inside-controller-for-header-footer-menu-purposes-tf4318722s16154.html#a12299261 Sent from the Zend Framework mailing list archive at Nabble.com.