|
|||
|
Hi there
![]() I am missing something in ZF docs, question is: how to set content defined like this: (file layout.phtml) Code:
<?= $this->layout()->content ?> Controller: Code:
class RegistrationController extends Zend_Controller_Action
{
public function firstAction() {
// do nothing, just proceed render the view/template
}
public function secondAction() {
// TODO: render the 'first' view/template
}
}
Code:
<?php
$this->render('registration/first.phtml');
?>
How should I do that? I have no idea, just spent a couple of hours searching the web for a solution, tried some tricks but nothing seems to work, so You guys are my last resort. Docs tell me how to add a sidebar nad placeholders but that doesn't fit my needs. Or am I trying to do something against MVC? Please help. I've lost a lot of time and i'm out of ideas... EDIT: I figured it now - don't know what went wrong when i tried it earlier. If anyone can present me more elegant solution i would be grateful. For now i will decorate Zend_Controller_Action class and write a wrapper for this... Controller part: Code:
$this->_helper->layout()->content = $this->_helper->layout()->render('registration/first');
sorry, it doesn't work. i left the second.phtml template intact, so it does the rendering of the first.phtml template Last edited by nixnet : 07-10-2008 at 11:20 AM. |
|
|||
|
Hello nixnet,
You're looking for functionality of the response object. Check out: Zend Framework: Documentation Your probably looking for something like: $this->getResponse()->setBody('content', $this->view->render('login/index.phtml')); Additionally, the front controller will always try to render the corresponding .phtml file for the controller unless you tell the front controller not to, with something like: $front->setParam('noViewRenderer', true); Side effect of this is that you will always have to render the view. The alternative, of course, is to just have a blank corresponding .phtml file. Hope this helps. steve |
![]() |
| Thread Tools | |
| Display Modes | |
|
|