Source for file Ethna_Renderer_Smarty.php
Documentation is available at Ethna_Renderer_Smarty.php
// vim: foldmethod=marker
* Ethna_Renderer_Smarty.php
* @author Kazuhiro Hosoi <hosoi@gree.co.jp>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
require_once 'Smarty/Smarty.class.php';
// {{{ Ethna_Renderer_Smarty
* Smartyレンダラクラス(Mojaviのまね)
* @author Kazuhiro Hosoi <hosoi@gree.co.jp>
/** @var string compile directory */
* Ethna_Renderer_Smartyクラスのコンストラクタ
parent::Ethna_Renderer($controller);
$this->engine =
& new Smarty;
// ディレクトリ関連は Controllerによって実行時に設定
// TODO: iniファイルによって上書き可にするかは要検討
$template_dir =
$controller->getTemplatedir();
$compile_dir =
$controller->getDirectory('template_c');
$this->setTemplateDir($template_dir);
$this->engine->template_dir =
$this->template_dir;
$this->engine->compile_id =
md5($this->template_dir);
// デリミタは Ethna_Config を見る
$smarty_config = isset
($this->config['smarty'])
?
$this->config['smarty']
$this->engine->left_delimiter =
$smarty_config['left_delimiter'];
$this->engine->right_delimiter =
$smarty_config['right_delimiter'];
// コンパイルディレクトリは必須なので一応がんばってみる
if (is_dir($this->engine->compile_dir) ===
false) {
$controller->getDirectory('plugins'),
array(ETHNA_BASE .
'/class/Plugin/Smarty', SMARTY_DIR .
'plugins')
* @param string $template テンプレート名
* @param bool $capture true ならば出力を表示せずに返す
function perform($template =
null, $capture =
false)
if ($template ===
null &&
$this->template ===
null) {
if ($template !==
null) {
$this->template =
$template;
||
is_readable($this->template_dir .
$this->template)) {
$captured =
$this->engine->fetch($this->template);
$this->engine->display($this->template);
* @param string $name 変数名
$property =
& $this->engine->get_template_vars($name);
if ($property !==
null) {
$this->engine->clear_assign($name);
$this->engine->assign($array);
$this->engine->assign_by_ref($array);
* @param string $name 変数名
$this->engine->assign($name, $value);
* @param string $name 変数名
$this->engine->assign_by_ref($name, $value);
* @param string $name プラグイン名
* @param string $type プラグインタイプ
* @param mixed $plugin プラグイン本体
$register_method =
'register_' .
$type;
if ($type ===
'prefilter' ||
$type ===
'postfilter' ||
$type ===
'outputfilter') {
parent::setPlugin($name, $type, $plugin);
$this->engine->$register_method($plugin);
parent::setPlugin($name, $type, $plugin);
$this->engine->$register_method($name, $plugin);
Documentation generated on Fri, 11 Nov 2011 04:00:49 +0900 by phpDocumentor 1.4.3