Zend_View-Helpers-Action.xml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect3 id="zend.view.helpers.initial.action">
  4. <title>Action View Helper</title>
  5. <para>
  6. The <classname>Action</classname> view helper enables view scripts to dispatch a
  7. given controller action; the result of the response object following the
  8. dispatch is then returned. These can be used when a particular action
  9. could generate re-usable content or "widget-ized" content.
  10. </para>
  11. <para>
  12. Actions that result in a <methodname>_forward()</methodname> or redirect are
  13. considered invalid, and will return an empty string.
  14. </para>
  15. <para>
  16. The <acronym>API</acronym> for the <classname>Action</classname> view helper follows that of
  17. most <acronym>MVC</acronym> components that invoke controller actions:
  18. <command>action($action, $controller, $module = null, array $params = array())</command>.
  19. <varname>$action</varname> and <varname>$controller</varname> are required; if no
  20. module is specified, the default module is assumed.
  21. </para>
  22. <example id="zend.view.helpers.initial.action.usage">
  23. <title>Basic Usage of Action View Helper</title>
  24. <para>
  25. As an example, you may have a <classname>CommentController</classname> with a
  26. <methodname>listAction()</methodname> method you wish to invoke in order to pull
  27. a list of comments for the current request:
  28. </para>
  29. <programlisting language="php"><![CDATA[
  30. <div id="sidebar right">
  31. <div class="item">
  32. <?php echo $this->action('list',
  33. 'comment',
  34. null,
  35. array('count' => 10)); ?>
  36. </div>
  37. </div>
  38. ]]></programlisting>
  39. </example>
  40. </sect3>
  41. <!--
  42. vim:se ts=4 sw=4 et:
  43. -->