Zend_View-Helpers-RenderToPlaceholder.xml 1.2 KB

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