Пример #1
0
 /**
  * 
  * Resets $this->_view_object to use the Layout templates.
  * 
  * This effectively re-uses the Solar_View object from the page
  * (with its helper objects and data) to build the layout.  This
  * helps to transfer JavaScript and other layout data back up to
  * the layout with zero effort.
  * 
  * Automatically sets up a template-path stack for you, searching
  * for layout files (e.g.) in this order ...
  * 
  * 1. Vendor/App/Example/Layout/
  * 
  * 2. Vendor/Controller/Page/Layout/
  * 
  * 3. Solar/Controller/Page/Layout/
  * 
  * @return void
  * 
  */
 protected function _setLayoutTemplates()
 {
     // get the parents of the current class, including self
     $stack = array_reverse(Solar_Class::parents($this, true));
     // remove Solar_Base
     array_pop($stack);
     // convert underscores to slashes, and add /Layout
     foreach ($stack as $key => $val) {
         $stack[$key] = str_replace('_', '/', $val) . '/Layout';
     }
     // done, add the stack
     $this->_view_object->setTemplatePath($stack);
 }
Пример #2
0
 /**
  *
  * Executes before rendering the controller view and layout.
  *
  * Use this to pre-process $this->_view_object, or to manipulate
  * controller properties with view helpers.
  *
  * The default implementation sets the locale class for the getText
  * helper.
  *
  * @return void
  *
  */
 protected function _preRender()
 {
     // set the locale class for the getText helper
     $class = get_class($this);
     $this->_view_object->getHelper('getTextRaw')->setClass($class);
     // inject special vars into the view
     $this->_view_object->controller = $this->_controller;
     $this->_view_object->action = $this->_action;
     $this->_view_object->layout = $this->_layout;
     $this->_view_object->errors = $this->_errors;
 }