Example #1
0
 public function __construct(Request $request)
 {
     $this->sfTemplate = Kohana_sfTemplate::instance();
     // try and guess the template we want to render based off the route
     $this->set_template($request->controller . '/' . $request->action);
     parent::__construct($request);
 }
Example #2
0
 public static function instance()
 {
     if (!Kohana_sfTemplate::$instance) {
         Kohana_sfTemplate::$config = Kohana::config('sftemplate');
         $loader = new sfTemplateLoaderFilesystem(Kohana_sfTemplate::$config->template_path);
         Kohana_sfTemplate::$instance = new sfTemplateEngine($loader);
         // load any helpers that we've defined
         if (!empty(Kohana_sfTemplate::$config->helpers)) {
             $helpers = array();
             foreach (Kohana_sfTemplate::$config->helpers as $helper => $enabled) {
                 if ($enabled) {
                     $helpers[] = new $helper();
                 }
             }
             $helper_set = new sfTemplateHelperSet($helpers);
             Kohana_sfTemplate::$instance->setHelperSet($helper_set);
         }
     }
     return Kohana_sfTemplate::$instance;
 }