| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect3 id="zend.view.helpers.initial.action">
- <title>Action View Helper</title>
- <para>
- The <classname>Action</classname> view helper enables view scripts to dispatch a
- given controller action; the result of the response object following the
- dispatch is then returned. These can be used when a particular action
- could generate re-usable content or "widget-ized" content.
- </para>
- <para>
- Actions that result in a <methodname>_forward()</methodname> or redirect are
- considered invalid, and will return an empty string.
- </para>
- <para>
- The <acronym>API</acronym> for the <classname>Action</classname> view helper follows that of
- most <acronym>MVC</acronym> components that invoke controller actions:
- <command>action($action, $controller, $module = null, array $params = array())</command>.
- <varname>$action</varname> and <varname>$controller</varname> are required; if no
- module is specified, the default module is assumed.
- </para>
- <example id="zend.view.helpers.initial.action.usage">
- <title>Basic Usage of Action View Helper</title>
- <para>
- As an example, you may have a <classname>CommentController</classname> with a
- <methodname>listAction()</methodname> method you wish to invoke in order to pull
- a list of comments for the current request:
- </para>
- <programlisting language="php"><![CDATA[
- <div id="sidebar right">
- <div class="item">
- <?php echo $this->action('list',
- 'comment',
- null,
- array('count' => 10)); ?>
- </div>
- </div>
- ]]></programlisting>
- </example>
- </sect3>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|