From: Jason S. <jsw...@ya...> - 2003-01-08 02:33:35
|
--- Arnold Cano <arn...@ya...> wrote: This > change resulted in a new ActionView class that > contained a display() method. From an Action's > perform() method I would return an ActionView object > to the ActionController. Then in the index.php file I > would get a reference to the ActionView object from > the ActionController and call it's display() method. > This change shouldn't affect Phrame's ability to use > various display technologies such as Smarty, XSLT, > Flash, etc. I am interested in this class. I ended up extending the ActionController class for my application and adding a ::showView() method. This method would internally determine the appropriate view, and the instantiate a Smarty object, assign values based on the view, assign common values, and render the template. This was not an entirely satisfying approach, but it did take the application.php file down to basically: if (action) { $controller->process($mappings, $_REQUEST); } else { $controller->showView() } The though process I was headed down, was to create a ViewManager class, that would instantiate Views as required. The Views would have some sort of a "prepare" method (in which I would assign data appropriate to the view to a single Smarty instance, probably owned by the ViewManager) as well as a "show/perform/display/render/whatever" method that would actually send the output. This was the direction I was headed because the large switch statement I had in my application extended controller class had to much of a "procedural" feel to it. HTH in some way. I am interested in hearing your thoughts. Jason __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |