
ぬ、ぬぁんだってぇぇぇぇ!!templateを書き換えるぅぅぅ???まじっすか!!
そんなことしたら私が先走って作ったカレンダーが動かなくなるぅぅっ!!
こういうとき、慌てずにググるのです。「FuelPHP template 切り替え」なんちゃってね。
つらつらと上位に出てくるいくつかを斜め読みするだけでも、なんとなく見えてくるものがあります。
まず、自動生成されたコントローラにbefore()メソッドを追加します。
class Controller_Tweet extends Controller_Template
{
public function before()
{
$this->template = "tweet/template";
parent::before();
}
public function action_index()
{
$data["subnav"] = array('index'=> 'active' );
$this->template->title = 'Tweet » Index';
$this->template->content = View::forge('tweet/index', $data);
}
}
んで、もともとあったtemplate.phpをviews/tweetの下にコピーしちゃいます。

で、このviews/tweet/template.phpを少し変えて、表示を確かめます。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $title; ?></title>
<?php echo Asset::css('bootstrap.css'); ?>
<style>
body { margin: 40px; }
</style>
</head>
<body>
<div class="container">
<div class="col-md-12">
<h1><?php echo $title; ?></h1>
<hr>
<?php if (Session::get_flash('success')): ?>
<div class="alert alert-success">
<strong>Success</strong>
<p>
<?php echo implode('</p><p>', e((array) Session::get_flash('success'))); ?>
</p>
</div>
<?php endif; ?>
<?php if (Session::get_flash('error')): ?>
<div class="alert alert-danger">
<strong>Error</strong>
<p>
<?php echo implode('</p><p>', e((array) Session::get_flash('error'))); ?>
</p>
</div>
<?php endif; ?>
</div>
<div class="col-md-12">
<h1>このテンプレートはtweet用じゃけんのぉ!!</h1>
<?php echo $content; ?>
</div>
<footer>
<p class="pull-right">Page rendered in {exec_time}s using {mem_usage}mb of memory.</p>
<p>
<a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.<br>
<small>Version: <?php echo e(Fuel::VERSION); ?></small>
</p>
</footer>
</div>
</body>
</html>

行けました。
このviews/tweet/template.phpを教科書通りに直して先へ進みます。
次回!