1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect3 id="zend.controller.actionhelpers.actionstack">
4 <title>ActionStack</title>
7 The <emphasis>ActionStack</emphasis> helper allows you to push requests to the
8 <link linkend="zend.controller.plugins.standard.actionstack">ActionStack</link>
9 front controller plugin, effectively helping you create a queue of
10 actions to execute during the request. The helper allows you to add
11 actions either by specifying new request objects or
12 action - controller - module sets.
16 <title>Invoking ActionStack Helper Initializes the ActionStack Plugin</title>
19 Invoking the <emphasis>ActionStack</emphasis> helper implicitly registers
20 the <emphasis>ActionStack</emphasis> plugin -- which means you do not need
21 to explicitly register the <emphasis>ActionStack</emphasis> plugin to use
26 <example id="zend.controller.actionhelpers.actionstack.simple">
27 <title>Adding a Task Using Action, Controller and Module Names</title>
30 Often, it's simplest to simply specify the action, controller, and
31 module (and optional request parameters), much as you would when
32 calling <methodname>Zend_Controller_Action::_forward()</methodname>:
35 <programlisting language="php"><![CDATA[
36 class FooController extends Zend_Controller_Action
38 public function barAction()
40 // Add two actions to the stack
41 // Add call to /foo/baz/bar/baz
42 // (FooController::bazAction() with request var bar == baz)
43 $this->_helper->actionStack('baz',
46 array('bar' => 'baz'));
48 // Add call to /bar/bat
49 // (BarController::batAction())
50 $this->_helper->actionStack('bat', 'bar');
56 <example id="zend.controller.actionhelpers.actionstack.simple2">
57 <title>Adding a Task Using a Request Object</title>
60 Sometimes the <acronym>OOP</acronym> nature of a request object makes most sense; you
61 can pass such an object to the <emphasis>ActionStack</emphasis> helper as
65 <programlisting language="php"><![CDATA[
66 class FooController extends Zend_Controller_Action
68 public function barAction()
70 // Add two actions to the stack
71 // Add call to /foo/baz/bar/baz
72 // (FooController::bazAction() with request var bar == baz)
73 $request = clone $this->getRequest();
74 // Don't set controller or module; use current values
75 $request->setActionName('baz')
76 ->setParams(array('bar' => 'baz'));
77 $this->_helper->actionStack($request);
79 // Add call to /bar/bat
80 // (BarController::batAction())
81 $request = clone $this->getRequest();
82 // don't set module; use current value
83 $request->setActionName('bat')
84 ->setControllerName('bar');
85 $this->_helper->actionStack($request);