-- 7eicher <[EMAIL PROTECTED]> wrote
(on Monday, 15 October 2007, 02:17 AM -0700):
> in my current project i built up a widget system based on ZF which allowes
> to run a front controller twice or more during runtime and getting the
> response of a so called subrequest in a view with:
> 
> <div id="calendar">
>   <?php echo $this->widget("calendar", "utils", "global-module"); ?>
> </div>
> 
> This post is for those who are interested in chaining the front controller
> object and getting allways the right instance when calling
> Zend_Controller_Front::getInstance().
> 
> The Problem with current Zend_Controller_Front is, that it implements the
> singelton pattern and it allways give the current instance back. that means,
> its not possible to have more than one instance at the same time. of course,
> this behavior is neccessary for the helperbrooker, but this is another
> topic.

Why do you need to run the front controller more than once during run
time? It has a dispatch loop allowing you to loop over multiple actions
during the same request -- so if you want to build up a widget system,
simply create plugins that push and pop from an action stack (this is in
fact part of the Zend_Layout proposal). 

The reason for the front controller being a singleton is in part to
simplify access to it from the various other areas (plugins, action
controller, etc), but also because, with the loop, there should be no
need for multiple instances. Can you better describe *why* you need
multiple instances, as well as why looping does not solve this issue?


-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to