| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect3 id="zend.controller.actionhelpers.actionstack">
- <title>ActionStack</title>
- <para>
- The <emphasis>ActionStack</emphasis> helper allows you to push requests to the
- <link linkend="zend.controller.plugins.standard.actionstack">ActionStack</link>
- front controller plugin, effectively helping you create a queue of
- actions to execute during the request. The helper allows you to add
- actions either by specifying new request objects or
- action - controller - module sets.
- </para>
- <note>
- <title>Invoking ActionStack Helper Initializes the ActionStack Plugin</title>
- <para>
- Invoking the <emphasis>ActionStack</emphasis> helper implicitly registers
- the <emphasis>ActionStack</emphasis> plugin -- which means you do not need
- to explicitly register the <emphasis>ActionStack</emphasis> plugin to use
- this functionality.
- </para>
- </note>
- <example id="zend.controller.actionhelpers.actionstack.simple">
- <title>Adding a Task Using Action, Controller and Module Names</title>
- <para>
- Often, it's simplest to simply specify the action, controller, and
- module (and optional request parameters), much as you would when
- calling <methodname>Zend_Controller_Action::_forward()</methodname>:
- </para>
- <programlisting language="php"><![CDATA[
- class FooController extends Zend_Controller_Action
- {
- public function barAction()
- {
- // Add two actions to the stack
- // Add call to /foo/baz/bar/baz
- // (FooController::bazAction() with request var bar == baz)
- $this->_helper->actionStack('baz',
- 'foo',
- 'default',
- array('bar' => 'baz'));
- // Add call to /bar/bat
- // (BarController::batAction())
- $this->_helper->actionStack('bat', 'bar');
- }
- }
- ]]></programlisting>
- </example>
- <example id="zend.controller.actionhelpers.actionstack.simple2">
- <title>Adding a Task Using a Request Object</title>
- <para>
- Sometimes the <acronym>OOP</acronym> nature of a request object makes most sense; you
- can pass such an object to the <emphasis>ActionStack</emphasis> helper as
- well.
- </para>
- <programlisting language="php"><![CDATA[
- class FooController extends Zend_Controller_Action
- {
- public function barAction()
- {
- // Add two actions to the stack
- // Add call to /foo/baz/bar/baz
- // (FooController::bazAction() with request var bar == baz)
- $request = clone $this->getRequest();
- // Don't set controller or module; use current values
- $request->setActionName('baz')
- ->setParams(array('bar' => 'baz'));
- $this->_helper->actionStack($request);
- // Add call to /bar/bat
- // (BarController::batAction())
- $request = clone $this->getRequest();
- // don't set module; use current value
- $request->setActionName('bat')
- ->setControllerName('bar');
- $this->_helper->actionStack($request);
- }
- }
- ]]></programlisting>
- </example>
- </sect3>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|