view-placeholders-intro.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="learning.view.placeholders.intro">
  4. <title>Introduction</title>
  5. <para>
  6. In <link linkend="learning.layout">the previous chapter</link>, we looked at primarily the
  7. Two Step View pattern, which allows you to embed individual application views within a
  8. sitewide layout. At the end of that chapter, however, we discussed some limitations:
  9. </para>
  10. <itemizedlist>
  11. <listitem>
  12. <para>
  13. How do you alter the page title?
  14. </para>
  15. </listitem>
  16. <listitem>
  17. <para>
  18. How would you inject conditional scripts or stylesheets into the sitewide layout?
  19. </para>
  20. </listitem>
  21. <listitem>
  22. <para>
  23. How would you create and render an optional sidebar? What if there was some content
  24. that was unconditional, and other content that was conditional for the sidebar?
  25. </para>
  26. </listitem>
  27. </itemizedlist>
  28. <para>
  29. These questions are addressed in the <ulink
  30. url="http://www.oracle.com/technetwork/java/compositeview-137722.html">Composite
  31. View</ulink> design pattern. One approach to that pattern is to provide "hints" or content
  32. to the sitewide layout. In Zend Framework, this is achieved through specialized view helpers
  33. called "placeholders." Placeholders allow you to aggregate content, and then render that
  34. aggregate content elsewhere.
  35. </para>
  36. </sect1>