いろいろ~備忘録~

WEBエンジニアによる記録

勉強になったことを記録

【FuelPHP】Presenterでtemplateを利用

概要

PresenterでTemplateを利用します。

Templateの利用方法は以下の記事を参考にしてみて下さい。
wakuwakupush.hatenablog.com



コントローラーにファイルを作成して、Templateを継承します。

<?php

class Controller_Welcome extends Controller_Template
{
    public function action_index()
    {
        $this->template->title = 'title';
        $this->template->content = Presenter::forge('welecome/index');
    }
}


Templateのプロパティ$This->templateはViewインスタンスになります。
結果、Templateの中に、Presenterを通して、welecome/indexの内容が埋め込まれます。