コード例 #1
0
ファイル: Smarty.php プロジェクト: riaf/ethna
 /**
  *  Ethna_Renderer_Smartyクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     $this->engine = new Smarty();
     // ディレクトリ関連は Controllerによって実行時に設定
     // TODO: iniファイルによって上書き可にするかは要検討
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     //  デリミタは Ethna_Config を見る
     $smarty_config = isset($this->config['smarty']) ? $this->config['smarty'] : array();
     if (array_key_exists('left_delimiter', $smarty_config)) {
         $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     }
     if (array_key_exists('right_delimiter', $smarty_config)) {
         $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     }
     // コンパイルディレクトリは必須なので一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
コード例 #2
0
ファイル: Smarty.php プロジェクト: hiroki-ta/my.project
 /**
  *  Ethna_Renderer_Smartyクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     // get renderer config
     $smarty_config = $this->config;
     // load template engine
     $this->loadEngine($smarty_config);
     $this->engine = new Smarty();
     // ディレクトリ関連は Controllerによって実行時に設定
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     // delimiter setting
     $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     // コンパイルディレクトリは必須なので一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
コード例 #3
0
ファイル: Smarty3.php プロジェクト: riaf/pastit
 /**
  *  Constructor for Ethna_Renderer_Smarty3
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     // get renderer config
     $smarty_config = isset($this->config['smarty3']) ? $this->config['smarty3'] : array();
     $this->loadEngine($smarty_config);
     $this->engine = new Smarty();
     // Configurerd by controller
     $template_dir = $controller->getTemplatedir();
     $compile_dir = $controller->getDirectory('template_c');
     $this->setTemplateDir($template_dir);
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $template_dir;
     $this->engine->compile_dir = $compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     if (isset($smarty_config['left_delimiter'])) {
         $this->engine->left_delimiter = $smarty_config['left_delimiter'];
     }
     if (isset($smarty_config['right_delimiter'])) {
         $this->engine->right_delimiter = $smarty_config['right_delimiter'];
     }
     // make compile dir
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->inheritance = true;
     $this->engine->plugins_dir = array_merge($controller->getDirectory('plugins'), array(ETHNA_BASE . '/class/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
コード例 #4
0
ファイル: Twig.php プロジェクト: t-f-m/ethna
 /**
  * @param Ethna_Controller $controller
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     $this->setTemplateDir($controller->getTemplatedir());
     $this->setCompileDir($controller->getDirectory('template_c'));
     $this->loadEngine($this->config);
 }
コード例 #5
0
ファイル: Smarty.php プロジェクト: dqneo/ethnam
 /**
  *  Ethna_Renderer_Smartyクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct(string $template_dir, array $option)
 {
     parent::__construct($template_dir, $option);
     $this->engine = new Smarty();
     // ディレクトリ関連は Kernelによって実行時に設定
     $compile_dir = $option['template_c'];
     $this->compile_dir = $compile_dir;
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     // delimiter setting
     $this->engine->left_delimiter = $this->config['left_delimiter'];
     $this->engine->right_delimiter = $this->config['right_delimiter'];
     // コンパイルディレクトリは必須なので一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->engine->plugins_dir = array_merge($option['plugins'], array(ETHNA_BASE . '/src/Plugin/Smarty', SMARTY_DIR . 'plugins'));
 }
コード例 #6
0
ファイル: Rhaco.php プロジェクト: riaf/ethna
 /**
  *  Ethna_Renderer_Rhacoクラスのコンストラクタ
  *
  *  @access public
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     $this->template_dir = $controller->getTemplatedir() . '/';
     $this->compile_dir = $controller->getDirectory('template_c');
     Rhaco::constant('TEMPLATE_PATH', $this->template_dir);
     $this->engine = new TemplateParser_Ethna();
     /*
             $this->setTemplateDir($template_dir);
             $this->compile_dir = $compile_dir;
     */
     $this->engine->template_dir = $this->template_dir;
     $this->engine->compile_dir = $this->compile_dir;
     $this->engine->compile_id = md5($this->template_dir);
     // 一応がんばってみる
     if (is_dir($this->engine->compile_dir) === false) {
         Ethna_Util::mkdir($this->engine->compile_dir, 0755);
     }
     $this->_setDefaultPlugin();
 }