different output than expected as your layout controls this. Are you
sure you are writing the response segments correctly?
Also I would use Zend_Controller_Request_Simple instead of cloning the
$request object.
Here is one of mine:
$categoryRequest = new Zend_Controller_Request_Simple();
$categoryRequest->setControllerName('category')
->setActionName('index')
->setParam('responseSegment', 'categoryMain');
2009/3/9 Cristian Bichis <contact@zftutorials.com>:
> Hello,
>
> I am trying to migrate one app from action view helper to using mainly
> Action Stack instead due to performance and not only.
>
> I am naming each zone as zone1, zone2 into layout, and from a controller
> plugin i am adding the corresponding request to action stack.
>
> // layout.phtml
> <div id="zone1"><?=$this->layout()->zone1?></div>
> <div id="content"><?=$this->layout()->content?></div>
>
> <div id="zone2"><?=$this->layout()->zone2?></div>
>
> // controller plugin
> class Default_Plugin_Test extends Zend_Controller_Plugin_Abstract
> {
> protected $_stack;
> public function getStack()
> {
> if (null === $this->_stack) {
> $front = Zend_Controller_Front::getInstance();
> if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
> $stack = new Zend_Controller_Plugin_ActionStack();
> $front->registerPlugin($stack);
> } else {
> $stack = $front->getPlugin('ActionStack');
> }
> $this->_stack = $stack;
> }
> return $this->_stack;
> }
> public function dispatchLoopStartup( Zend_Controller_Request_Abstract
> $request)
> {
> $this->_stack = $this->getStack();
> $request1 = clone($request);
> $request1->setControllerName('index')
> ->setActionName('zone1')
> ->setParam('responseSegment', 'zone1');
> $this->_stack->pushStack($request1);
> $request2 = clone($request);
> $request2->setControllerName('index')
> ->setActionName('zone2')
> ->setParam('responseSegment', 'zone2');
> $this->_stack->pushStack($request2);
> }
> }
>
> //Output:
>
> Content
>
> Zone 2
>
> Zone 1
>
>
> I got some problems on making Action stack works as supposed, basically as
> you see from Output, instead to be rendered as:
>
> Zone1
> Content
> Zone2
>
> The final output looks slightly different.
>
> Any ideea why ?
>
>
> --
> Best regards,
> Cristian Bichis
> www.zftutorials.com | www.zfforums.com | www.zftalk.com | www.zflinks.com
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------
没有评论:
发表评论