My understanding of the actionStack is that is just performs an action (duh) no matter what. You set a priority for it (avoid 99 because it is reserved) and that does the trick. You then set in the actionStack the controller/action you need to 'run' and that is it.
So in the above by Pawel, the actionStack will run the menu action from the index controller. You then set the code to generate the menu in that action and the menu appears.
Personally I have found this to work like a charm if you want to have a static menu and just display it. Since I didn't know how to have variables passed based on the action clicked so that I can do fancy stuff with the menu (i.e. make one of the menu options not have a link and show as active) I opted for a different solution. I created a static function in my bootstrap which I pass a variable. The variable is the key of an array which defines my menu. Upon the init of each controller I make the call with the relevant key and I get back the HTML which I then pass on the view. Crude but effective.
I hope this helps.
Nikos
--
The contents of this message may contain confidential or privileged information and is intended solely for the recipient(s). Use or distribution to and by any other party is not authorized. If you are not the intended recipient, copying, distribution or use of the contents of this information is prohibited.
On Tue, Sep 9, 2008 at 9:46 AM, monk.e.boy <john.glazebrook@guava.com> wrote:
Paweł Chuchmała wrote:
>
>
>
>
Thanks! After a little googling I understood what you meant.
Why do we use an actionStack?
I thought that in my view I would do:
$this->menu = 99;
Then in my layout I'd use this number to choose the menu. Or something.
Thanks,
monk.e.boy
--
View this message in context: http://www.nabble.com/Controller-Menus-tp19390796p19392782.html
Sent from the Zend MVC mailing list archive at Nabble.com.
--
The contents of this message may contain confidential or privileged information and is intended solely for the recipient(s). Use or distribution to and by any other party is not authorized. If you are not the intended recipient, copying, distribution or use of the contents of this information is prohibited.
没有评论:
发表评论