Example #1
0
 /**
  * Initialize properties before running the controller methods (actions),
  * so they are available to our action.
  */
 public function before($template = NULL)
 {
     parent::before();
     Theme::checker();
     $this->maintenance();
     $this->private_site();
     //get category, deprecated, to keep backwards compatibility with themes
     self::$category = Model_Category::current();
     //Gets a coupon if selected
     self::$coupon = Model_Coupon::current();
     //get the affiliate if any
     Model_Affiliate::current();
     if ($this->auto_render === TRUE) {
         // Load the template
         if ($template !== NULL) {
             $this->template = $template;
         }
         $this->template = View::factory($this->template);
         // Initialize template values
         $this->template->title = core::config('general.site_name');
         $this->template->meta_keywords = '';
         $this->template->meta_description = '';
         $this->template->meta_copyright = 'Open eShop ' . Core::VERSION;
         $this->template->content = '';
         $this->template->styles = array();
         $this->template->scripts = array();
         //we can not cache this view since theres dynamic parts
         //$this->template->header  = View::factory('header');
         //setting inner views try to get from fragment
         // if (Auth::instance()->logged_in())
         //     $this->template->header  = View::fragment('header_front_login','header');
         // else
         $this->template->header = View::factory('header');
         //no fragment since CSRF gets cached :(
         $this->template->footer = View::fragment('footer_front', 'footer');
     }
 }