title: Overwrite zend view directory?
body: <p>In my bootstrap, I detect the site the users on, then issue the layout change and helper change. Essentially anything that is there by default is what the site falls back on if there is no per site version in /public/site/</p>
  
  <p>However I cannot get the actual view to rely on a path a give it or a path in /public/site.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>protected function _initSite() {
  
          $this-&gt;bootstrap('db');
          $db             = $this-&gt;getPluginResource('db')-&gt;getDbAdapter();
          $site_domain    = strtolower($_SERVER['HTTP_HOST']);
  
          //site
          $query = $db-&gt;prepare("
              SELECT s.*, so.* 
              FROM Site AS s
              JOIN Site_Domain AS sd ON sd.site_id = s.id
              JOIN Site_Option AS so ON so.site_id = s.id 
              WHERE sd.domain = :site_domain AND s.enabled = '1'
              LIMIT 1
          ");
          $query-&gt;bindValue('site_domain', $site_domain);
          $query-&gt;execute();
          $site = $query-&gt;fetch(PDO::FETCH_OBJ);
          $query-&gt;closeCursor();
  
          if (empty($site)) {
              throw new exception('Unfortunately we were unable to load the site you requested via the domain you came to.');
          }
  
          //site definitions - we need to get away from defining global variables, so lazy
          define('SITE_ID', $site-&gt;id);
  
          //layout paths
          Zend_Layout::startMvc(array(
              'layout' =&gt; 'layout',
              'layoutPath' =&gt; array(
                  APPLICATION_PATH.'/layouts/scripts/',
                  PUBLIC_PATH.'/site/'.$site-&gt;id.'/layouts/scripts/'
              )
          ));
  
  
  
          $view = $this-&gt;getResource('view');
          //set site to view, we use alot of google anayltics code so
          $view-&gt;site = $site;
          //set title seperator
          $view-&gt;headTitle($site-&gt;title)-&gt;setSeparator(' - ');
          //add base path for layout overriding
          $view-&gt;addBasePath(APPLICATION_PATH.'/modules/:module/views/');
          //register view helper path
          $view-&gt;addHelperPath('My/View/Helper/', 'My_View_Helper_');
  
          //register partials fallback path
          $view-&gt;addScriptPath(APPLICATION_PATH.'/layouts/partials');
          //default partials path
          $view-&gt;addScriptPath(PUBLIC_PATH.'/site/'.$site-&gt;id.'/layouts/partials/');//the default helpers
  
          //bind objects to the registry
          Zend_Registry::set('config',    array('meta_description' =&gt; $site-&gt;meta_description, 'meta_keywords' =&gt; $site-&gt;meta_keywords));
          Zend_Registry::set('site',      $site);
          return $site;
      }
  </code></pre>
  
  <p>Essentially when landing on the site, Zend_View should check to see if /public/site/1/layouts/view/scripts/default/index/index.phtml exists and use it, if it doesn't then use /application/modules/default/views/scripts/index/index.phtml and use it.</p>