php oil g controller post index detail --with-presenter
でコントローラ、プレゼンター、ビューの作成を行い
ためしに、localhost/post
で表示させてみたらエラーとなってしまいました。
(Fuelphp1.7.3を使ってます)
生成されたソースを見ると、たぶんpresenter
を呼び出してないからだと思うのですが
Controller_Template
を継承したコントローラーからどうプレゼンターを使えばいいのでしょうか?
↓自動生成されたソース抜粋
lang
1<?php 2class Controller_Post extends Controller_Template 3{ 4 5 public function action_index() 6 { 7 $data["subnav"] = array('index'=> 'active' ); 8 $this->template->title = 'Post » Index'; 9 $this->template->content = View::forge('post/index', $data); 10 } 11 12 public function action_detail() 13 { 14 $data["subnav"] = array('detail'=> 'active' ); 15 $this->template->title = 'Post » Detail'; 16 $this->template->content = View::forge('post/detail', $data); 17 } 18 19} 20
lang
1<?php 2class Presenter_Post_index extends Presenter 3{ 4 public function view() 5 { 6 $this->content = "Post » index"; 7 } 8}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。