ZF-2814: Create View Helper to Render code into a placeholder
Description
Another thing you could do is create your own helper -- let's call it 'renderToPlaceholder'. It could work like this:
<? $this->renderToPlaceholder('account/_signin_side.phtml', 'RIGHTBAR') ?>
and internally have code something like this:
class My_View_Helper_RenderToPlaceholder
{
public $view;
public function setView(Zend_View_Interface $view)
{
$this->view = $view;
}
public function renderToPlaceholder($script, $placeholder)
{
$this->view->placeholder($placeholder)->captureStart();
echo $this->view->render($script);
$this->view->placeholder($placeholder)->captureEnd();
}
}
Place it in your helper path:
$view->addHelperPath('My/View/Helper/', 'My_View_Helper');
and you'd be good to go.
Comments
Posted by Wil Sinclair (wil) on 2008-03-25T20:33:29.000+0000
Please categorize/fix as needed.
Posted by Jon Whitcraft (sidhighwind) on 2008-03-26T13:25:37.000+0000
I created this issue for Matthew. He would know more about it than I do. It was from the mailing list.
Posted by Matthew Weier O'Phinney (matthew) on 2008-05-09T12:42:20.000+0000
Scheduling for next minor release (new functionality)
Posted by Ralph Schindler (ralph) on 2008-08-06T23:13:15.000+0000
Resolved at r10747 in trunk. Resolved at r10748 in release 1.6 branch.
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:02.000+0000
Updating for the 1.6.0 release.