Hi Shawn,

I admit it is annoying, but you can turn it off like so:

        *$controller->setParam('noViewRenderer', true);

   *

Also this discussion helped with a problem I was trying to solve, namely, I wanted a View_Setup function.

I have one(basically) template and I want to skin/theme it differently based on which module(area) is being accessed. The masthead changes and maybe the background based on which module I'm in. I got what I wanted by writing a plugin and overriding the predispatch function.

   *class View_Setup_Plugin extends Zend_Controller_Plugin_Abstract
   {
     public function preDispatch($request)
     {
       include("app.php");
global $_APP; application_start(); ** // load global site data int $_APP*
   *    $view = Zend_Registry::get('view');
       $dict = Zend_Registry::get('dict');    // get site dictionary

       $controller = $request->controller;
       $action = $request->action;
       $module = $request->module;
switch($module) { case 'default':
       case   'services' :
$dict->add_def('updated',$_APP['updated']); $view->mast_mid = "<h1>" . SITE_NAME . "</h1>";
                  $view->mast_left = $dict->xlate('updated');
                  $view->mast_right = get_login_form();

              break;
       case   'admin' :
                  $view->mast_mid = "<h1>" . "Administration" . "</h1>";
                  $view->mast_left = "<img alt=\"administrative fish\"
   src=\"/public/images/admin.jpg\"> ";
                  $view->mast_right = "<h2>$controller::$action</h2>";
              break;
       case   'development' :
                  $view->mast_mid = "<h1>" . "Development Tools" . "</h1>";
                  $view->mast_left = "<img alt=\"a screw driver\"
   src=\"/public/images/tools01.jpg\">";
                  $view->mast_right = "<h2>$controller::$action</h2>";
              break;
       case   'testing' :
                  $view->mast_mid = "<h1>" . "Test Area" . "</h1>";
                  $view->mast_left = "<img alt=\"man testing (4K)\"
   src=\"/public/images/testing.jpg\" height=\"114\"width=\"141\">" ;
                  $view->mast_right = "<h2>$controller::$action</h2>";
break; }
     }
   }        *


I inject it into the controller like so:

   *$view_setup = new View_Setup_Plugin ();
   $controller->registerPlugin($view_setup );

   *

If I need to, I can override the defaults in the actionController init() function or in the action itself. Works like magic!
Its like the Rolling stones lyrics:

You can't always get what you want, but if you try sometimes, you get what you need. =]

cheers,
pat

Reply via email to