1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect3 id="zend.view.helpers.initial.rendertoplaceholder">
<title>RenderToPlaceholder Helper</title>
<para>
Renders a template (view script) and stores the rendered output as a
placeholder variable for later use.
</para>
<note role="info">
<para>
The helper uses the <link linkend="zend.view.helpers.initial.placeholder">Placeholder helper</link>
and his <link linkend="zend.view.helpers.initial.placeholder.capture">Capture methods</link>.
</para>
</note>
<example id="zend.view.helpers.initial.rendertoplaceholder.usage">
<title>Basic Usage of RenderToPlaceholder</title>
<programlisting language="php"><![CDATA[
<?php
// View script (backlink.phtml):
echo sprintf(
'<p class="older"><a href="%s">Older posts</a></p>',
$this->url(array('controller' => 'index', 'action' => 'index'))
)
?>
<?php
// Usage:
$this->renderToPlaceholder('backlink.phtml', 'link');
?>
<?php
echo $this->placeholder('link');
// Output: <p class="older"><a href="index/index">Older posts</a></p>
?>
]]></programlisting>
</example>
</sect3>
|