Codeigniterフレームワークを使い始めましたが、PhilSturgeonのCodeigniterテンプレートを使用したいと思います。
http://github.com/philsturgeon/codeigniter-template/zipball/master
私は以下のようなインストール手順に従いました:
- 最新バージョンをダウンロードする
- このパッケージからアプリケーションフォルダの対応するフォルダにファイルをコピーします
config/template
(configディレクトリ内の)対応する場所にコピーします。libraries/template
対応する場所(ライブラリディレクトリ内)にコピーします。$this->load->library('template');
テンプレートの読み込み(書き込みconfig/autoload.php
)
そして最後に、このテンプレートをコントローラーで次のように使用します。
public function index() {
$data["header"] = "ayastr";
$data["content"] = "content1";
$this->template->enable_parser(TRUE);
$this->template->enable_parser_body(TRUE);
//$this->template->set('title', "test");
$this->template->title("aya");
$this->template->build('example_page_view', $data);
}
ビューexample_page_view.php
で、私は持っているlayouts\default.php
、私は書いた
{{ template:title }}
..でdefault.php
。しかし、title変数にアクセスできません。私は何を間違えましたか、またはしませんでしたか?$ template ['title']を使用できるこのセクションを追加しましdefault.php
たが、変数を表示するためにパーサーを使用できません。