2006-06-03 (土)
■ Ethna のテンプレートエンジンに Simplate を使う (3)
Ethna_Flexy.php を見てみると、 HTML_Template_Flexy_SmartyAPI クラスを拡張して Smarty クラス(もどき)を定義していた。 いいな、このやり方。自分もやってみよう。
Ethna_Simplate.php の雛型を作ってみた。 最初 simplate() メソッドを呼ぶように書いたらエラーになったので、 parent::__construct(); に書き直した。 そのため、PHP5 以上必須。
<?php
define('SMARTY_DIR', '');
class Smarty extends simplate
{
function Smarty()
{
parent::__construct();
$this->left_delimiter = '{';
$this->right_delimiter = '}';
}
function assign_by_ref($key, $value)
{
$this->assign($key, $value);
}
function register_modifier()
{
}
function register_function()
{
}
function register_block()
{
}
}
?>
これを、Ethna の class ディレクトリにインストール。
Ethna.php の以下の行をコメントアウト。
include_once('Smarty/Smarty.class.php');
Ethna.php に以下の行を追加。
include_once(ETHNA_BASE . '/class/Ethna_Simplate.php');
これだけの作業で、Ethna 本体をいじらなくても Simplate が使える。
[コメントを書く]
本日のリンク元
- 3 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
- 2 google検索(Ethna_Simplate)
- 2 google検索(ethna_flexy)
- 1 google検索(HTML_Template_Flexy_SmartyAPI)
- 1 google検索(smarty ethna コンパイラ関数)
- 1 google検索(smarty assign ethna)
- 1 google検索(register_block smarty)
- 1 google検索(left_delimiter ethna)
- 1 google検索(Ethna __construct)
- 1 google検索(Ethna Smartyクラス)
- 1 google検索(Ethna SMARTY_DIR)
- 1 google検索(smarty function ethna)
- 1 google検索(php include_onceのバグ)
- 1 google検索(register_function ZendFramework)
- 1 google検索(php5 register_block)
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://72.14.235.104/search?q=cache:gWabOs0b4e8J:w...
- 1 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
- 1 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
- 1 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
- 1 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
- 1 http://209.85.175.104/search?q=cache:gWabOs0b4e8J:...
