<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>せつないぶろぐ &#187; Kohana</title>
	<atom:link href="http://blog.setunai.net/category/kohana/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.setunai.net</link>
	<description>ソフトウェア開発、アジャイルなどについてＳＥ兼ＰＧが思った事を書いてます。たまにプログラムも</description>
	<lastBuildDate>Mon, 06 Feb 2012 15:04:45 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Kohanaで入力→確認→完了までを作ってみた</title>
		<link>http://blog.setunai.net/20080206/kohana%e3%81%a7%e5%85%a5%e5%8a%9b%e2%86%92%e7%a2%ba%e8%aa%8d%e2%86%92%e5%ae%8c%e4%ba%86%e3%81%be%e3%81%a7%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/</link>
		<comments>http://blog.setunai.net/20080206/kohana%e3%81%a7%e5%85%a5%e5%8a%9b%e2%86%92%e7%a2%ba%e8%aa%8d%e2%86%92%e5%ae%8c%e4%ba%86%e3%81%be%e3%81%a7%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 14:59:38 +0000</pubDate>
		<dc:creator>t</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHPTAL]]></category>

		<guid isPermaLink="false">http://blog.setunai.net/20080206/kohana%e3%81%a7%e5%85%a5%e5%8a%9b%e2%86%92%e7%a2%ba%e8%aa%8d%e2%86%92%e5%ae%8c%e4%ba%86%e3%81%be%e3%81%a7%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/</guid>
		<description><![CDATA[ユーザーの登録～完了まで。 入力項目は名前とmailアドレス。 guesswork利用した時と似た感じになった。 自分がやりやすいからだと思うのだけど、これ正しいやり方？ CodeIgniter利用しても似た感じになるの [...]]]></description>
			<content:encoded><![CDATA[<p>ユーザーの登録～完了まで。<br />
入力項目は名前とmailアドレス。</p>
<p>guesswork利用した時と似た感じになった。<br />
自分がやりやすいからだと思うのだけど、これ正しいやり方？<br />
CodeIgniter利用しても似た感じになるのかなー。</p>
<p>テンプレートエンジンにPHPTAL使ったのでview系のヘルパーは一切利用してません。</p>
<p>■コントローラ</p>
<p>・/application/controllers/reg.php</p>
<pre class="code">
&lt;?php defined('SYSPATH') or die('No direct script access.');

class Reg_Controller extends Controller {

  function __construct()
  {
    parent::__construct();

    $this-&gt;validation-&gt;error_format('{message}');
  }

  function index($status='init')
  {
    $fields = array('username', 'mail', 'mail_confirm');

    $methodName = sprintf('index_%s', $status);
    if (!method_exists($this, $methodName)) {
      throw new Kohana_Exception('status error $status');
    }

    $this-&gt;$methodName($fields);
  }

  private function index_init($fields)
  {
    $data = array();
    foreach($fields as $key) {
      $data[$key] = '';
      $data[$key.'_error'] = '';
    }
    $this-&gt;ptal-&gt;view('reg/index', $data);
  }

  private function index_edit($fields)
  {
    $confirmData = $this-&gt;session-&gt;get('confirmData');
    $data = array();
    foreach($fields as $key) {
      $data[$key] = $confirmData[$key];
      $data[$key.'_error'] = '';
    }
    $this-&gt;ptal-&gt;view('reg/index', $data);
  }

  private function index_confirm($fields)
  {
    $data = $this-&gt;getInput($fields);

    $rules['username'] = 'required';
    $rules['mail'] = 'required|valid_email';
    $rules['mail_confirm'] = 'required|valid_email|matches[mail]';
    $this-&gt;validation-&gt;set_rules($rules);

    if ($this-&gt;validation-&gt;run() == FALSE)
    {
      foreach(array_keys($rules) as $key) {
        $fieldName = $key.'_error';
        $data[$fieldName] = $this-&gt;validation-&gt;$fieldName;
      }

      // 入力画面
      $this-&gt;ptal-&gt;view('reg/index', $data);
      return;
    }

    foreach($fields as $name) {
      $confirmData[$name] = $data[$name];
    }

    $this-&gt;session-&gt;set('confirmData', $confirmData);

    // 確認画面
    $this-&gt;ptal-&gt;view('reg/confirm', $data);
  }

  function send()
  {
    $confirmData = $this-&gt;session-&gt;get_once('confirmData');
    if (!$confirmData) {
      url::redirect('/reg');
      return;
    }

    // TODO:DB登録処理

    // TODO:メール送信処理

    $data['mail'] = $confirmData['mail'];

    // 完了画面
    $this-&gt;ptal-&gt;view('reg/send', $data);
  }

  private function getInput($nameList)
  {
    $data = array();
    foreach($nameList as $name) {
      $data[$name] = $this-&gt;input-&gt;post($name);
    }

    return $data;
  }

}
</pre>
<p><span id="more-439"></span></p>
<p>■テンプレート</p>
<p>・/application/views/reg/index.html（入力）</p>
<pre class="code">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;入力画面&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;!-- ここから上はダミー --&gt;
    &lt;div id=&quot;content&quot; metal:define-macro=&quot;content&quot;&gt;
      &lt;form action=&quot;/reg/index/confirm&quot; method=&quot;post&quot;&gt;
        &lt;table&gt;
          &lt;tr&gt;
            &lt;td class=&quot;label&quot;&gt;*ユーザー名&lt;/td&gt;
            &lt;td class=&quot;input&quot;&gt;&lt;input tal:attributes=&quot;value username&quot; name=&quot;username&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;
            &lt;td class=&quot;msg&quot; tal:content=&quot;username_error&quot;&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class=&quot;label&quot;&gt;*mail&lt;/td&gt;
            &lt;td class=&quot;input&quot;&gt;&lt;input tal:attributes=&quot;value mail&quot; name=&quot;mail&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;
            &lt;td class=&quot;msg&quot; tal:content=&quot;mail_error&quot;&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td class=&quot;label&quot;&gt;*mail（確認）&lt;/td&gt;
            &lt;td class=&quot;input&quot;&gt;&lt;input tal:attributes=&quot;value mail_confirm&quot; name=&quot;mail_confirm&quot; type=&quot;text&quot; /&gt;&lt;/td&gt;
            &lt;td class=&quot;msg&quot; tal:content=&quot;mail_confirm_error&quot;&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;
        &lt;input type=&quot;submit&quot; value=&quot;確認&quot; /&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;!-- ここから下はダミー --&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>・/application/views/reg/confirm.html（確認）</p>
<pre class="code">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;確認画面&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;&lt;!-- ここから上はダミー --&gt;
&lt;div id=&quot;content&quot; metal:define-macro=&quot;content&quot;&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td class=&quot;label&quot;&gt;ユーザー名&lt;/td&gt;
      &lt;td class=&quot;value&quot; tal:content=&quot;username&quot;&gt;ユーザー名&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&quot;label&quot;&gt;mail&lt;/td&gt;
      &lt;td class=&quot;value&quot; tal:content=&quot;mail&quot;&gt;mail&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div&gt;
    &lt;a href=&quot;/reg/index/edit/&quot;&gt;修正&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;/reg/send&quot;&gt;送信&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;
  &lt;!-- ここから下はダミー --&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>・/application/views/reg/send.html（完了）</p>
<pre class="code">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;完了画面&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;&lt;!-- ここから上はダミー --&gt;
&lt;div id=&quot;content&quot; metal:define-macro=&quot;content&quot;&gt;
  &lt;p&gt;&lt;span tal:content=&quot;mail&quot;&gt;メアド&lt;/span&gt;に確認メールを送信しました。&lt;/p&gt;
&lt;/div&gt;
  &lt;!-- ここから下はダミー --&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Validation便利なんだけどメッセージが英語なんだよね。<br />
日本語対応とかしないとダメだよね。きっと^^;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.setunai.net/20080206/kohana%e3%81%a7%e5%85%a5%e5%8a%9b%e2%86%92%e7%a2%ba%e8%aa%8d%e2%86%92%e5%ae%8c%e4%ba%86%e3%81%be%e3%81%a7%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohanaのautoload</title>
		<link>http://blog.setunai.net/20080203/kohana%e3%81%aeautoload/</link>
		<comments>http://blog.setunai.net/20080203/kohana%e3%81%aeautoload/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 15:26:39 +0000</pubDate>
		<dc:creator>t</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.setunai.net/20080203/kohana%e3%81%aeautoload/</guid>
		<description><![CDATA[Kohanaは情報が少ないのでCodeIgniterのサイトから情報を収集しているのだけれどやっぱりちょっと違う部分もある。 それでちょっと悩んだのがautoload。 autoloadとはクラス（機能）の自動読み込み。 [...]]]></description>
			<content:encoded><![CDATA[<p>Kohanaは情報が少ないのでCodeIgniterのサイトから情報を収集しているのだけれどやっぱりちょっと違う部分もある。<br />
それでちょっと悩んだのが<strong>autoload</strong>。</p>
<p>autoloadとはクラス（機能）の自動読み込み。これを利用すると、毎回loadメソッドを呼び出す必要がない。</p>
<p>CodeIgniterの場合はapplication/config/autoload.phpで設定を行う。<br />
Kohanaではconfig.phpのautoloadに設定するっぽい。</p>
<p>設定内容はこんな感じ</p>
<p>application/config/config.php</p>
<pre class="code">
$config = array
(
  'site_domain'          =&gt; 'localhost/',
  'site_protocol'        =&gt; 'http',
  'index_page'           =&gt; 'index.php',
  'url_suffix'           =&gt; '.html',
  'allow_config_set'     =&gt; FALSE,
  'global_xss_filtering' =&gt; FALSE,
  'extension_prefix'     =&gt; 'MY_',
  'include_paths'        =&gt; array
  (
  ),
  'autoload'             =&gt; array
  (
    'libraries' =&gt; 'session, ptal',
    'models'    =&gt; ''
  )
);
</pre>
<p>これでsessionクラスとptalクラスが使えます。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.setunai.net/20080203/kohana%e3%81%aeautoload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inputクラスのxss_cleanメソッド</title>
		<link>http://blog.setunai.net/20080201/input%e3%82%af%e3%83%a9%e3%82%b9%e3%81%aexss_clean%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89/</link>
		<comments>http://blog.setunai.net/20080201/input%e3%82%af%e3%83%a9%e3%82%b9%e3%81%aexss_clean%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 15:41:50 +0000</pubDate>
		<dc:creator>t</dc:creator>
				<category><![CDATA[Kohana]]></category>

		<guid isPermaLink="false">http://blog.setunai.net/20080201/input%e3%82%af%e3%83%a9%e3%82%b9%e3%81%aexss_clean%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89/</guid>
		<description><![CDATA[KohanaのInputクラスを検証。 xss_cleanメソッドってscriptタグを丸々消し去るのね。 ちなみにxss_cleanメソッドはクロスサイトスクリプティング攻撃防止フィルタ。 ■controller fu [...]]]></description>
			<content:encoded><![CDATA[<p>KohanaのInputクラスを検証。<br />
xss_cleanメソッドってscriptタグを丸々消し去るのね。<br />
ちなみにxss_cleanメソッドはクロスサイトスクリプティング攻撃防止フィルタ。</p>
<p>■controller</p>
<pre class="code">
  function index()
  {
    $posts = $this-&gt;input-&gt;post();
    print Kohana::debug($posts);
    echo sprintf(&quot;&lt;pre&gt;%s&lt;/pre&gt;\n&quot;, print_r($posts, true));
    echo sprintf(&quot;&lt;pre&gt;%s&lt;/pre&gt;\n&quot;, print_r($this-&gt;input-&gt;xss_clean($posts), true));
  }
</pre>
<p>■結果（HTMLソース）</p>
<pre class="code">
&lt;pre&gt;Array
(
    [name] =&amp;gt; &amp;lt;b&amp;gt;a&amp;lt;/b&amp;gt;
    [email] =&amp;gt; &amp;lt;script&amp;gt;aler(2);&amp;lt;/script&amp;gt;
    [email_confirm] =&amp;gt; c
)

&lt;/pre&gt;&lt;pre&gt;Array
(
    [name] =&gt; &lt;b&gt;a&lt;/b&gt;
    [email] =&gt; &lt;script&gt;aler(2);&lt;/script&gt;
    [email_confirm] =&gt; c
)
&lt;/pre&gt;
&lt;pre&gt;Array
(
    [name] =&gt; &lt;b&gt;a&lt;/b&gt;
    [email] =&gt; aler(2);
    [email_confirm] =&gt; c
)
&lt;/pre&gt;
</pre>
<p>当面ブログ記事はKohanaとPHPTALの作業メモになりそう^^;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.setunai.net/20080201/input%e3%82%af%e3%83%a9%e3%82%b9%e3%81%aexss_clean%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KohanaフレームワークでPHPTALを利用してみた２</title>
		<link>http://blog.setunai.net/20080131/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%92/</link>
		<comments>http://blog.setunai.net/20080131/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%92/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 15:22:33 +0000</pubDate>
		<dc:creator>t</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHPTAL]]></category>

		<guid isPermaLink="false">http://blog.setunai.net/20080131/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%92/</guid>
		<description><![CDATA[前回の記事ではとりあえずKohanaフレームワークからPHPTALを呼び出すところまで試してみた。 なんとなく繋がったので今度はより実践向きに共通ヘッダーやフッターを利用できるバージョンにしてみる。 共通のヘッダーやフッ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.setunai.net/20080125/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f/">前回</a>の記事ではとりあえずKohanaフレームワークからPHPTALを呼び出すところまで試してみた。<br />
なんとなく繋がったので今度はより実践向きに共通ヘッダーやフッターを利用できるバージョンにしてみる。</p>
<p>共通のヘッダーやフッターを表示させるには主に２パターン<br />
・コンテンツのテンプレートを書いてそこからヘッダーとフッターを呼ぶ<br />
・共通のレイアウトから内部だけくり抜いてコンテンツを当て込む</p>
<p>なんとなくCakePHP使ったときにやりやすかった共通のレイアウトの中身くり抜いて内部のコンテンツを当て込む方法を採用。</p>
<p>PHPTALを調べていたらちょうど良さそうなのを発見！<br />
<strong>METAL(Macro Extension for TAL)</strong>、コンテンツの中身を書き換えてくれるらしいのでこれを使って作ってみる。</p>
<p>悩ましいのが２パターンどちらの方法を使ってもhtmlソースがちぎられた状態で存在してしまうこと。<br />
テンプレートファイルがいきなりdivから始まってたりするとデザーナーさんでも読みやすいPHPTALのテンプレート特性を生かせない。<br />
とりあえずはコンテンツ用のテンプレートにはダミーのヘッダー、フッターを書いてもらうことにする。<br />
これで極端なテンプレートにはならないと思うけど、いまいちかな？</p>
<p>■設定ファイルとライブラリ</p>
<p>/system/application/config/ptal.php</p>
<pre class="code">
&lt;?php defined('SYSPATH') or die('No direct access allowed.');
/*
 * File: Ptal
 *
 * Options:
 *  dir     -
 *  suffix   -
 *  layout   -
 *  title-default   -
 *  title-format   -
 */
$config = array
(
  'dir' =&gt; APPPATH.'views/',
  'suffix' =&gt; '.html',
  'layout' =&gt; APPPATH.'views/common/layout.html',
  'title-default' =&gt; 'せつないぶろぐ',
  'title-format' =&gt; '%s / せつないぶろぐ'
);
</pre>
<p>/system/libraries/Ptal.php</p>
<pre class="code">
&lt;?php if (!defined('SYSPATH')) exit('No direct script access.');
/*
 * Class: Ptal
 *
 *  author    - t@setunai.net
 *  license   -
 */
require 'PHPTAL.php';

class Ptal_Core {

  protected static $config;

  /*
   * Constructor: __construct
   *
   */
  public function __construct()
  {
    // Load config
    self::$config = Config::item('ptal');
  }

  /*
   * Method: fetch
   *
   * Parameters:
   *  tmpl -
   *  data - title, any
   *  options - meta-http, meta-name, js, css
   *
   */
  function fetch($tmpl, $data, $options=array()) {
    $dir = self::$config['dir'];
    $suffix = self::$config['suffix'];
    $layout = self::$config['layout'];

    $tmplPath = sprintf('%s%s%s', $dir, $tmpl, $suffix);

    // title
    if (isset($data['title'])) {
      $data['title'] = sprintf(self::$config['title-format'], $data['title']);
    } else {
      $data['title'] = self::$config['title-default'];
    }

    // data
    $phptal = new PHPTAL($layout);
    foreach($data as $p =&gt; $value) {
      $phptal-&gt;$p = $value;
    }
    $phptal-&gt;tmpl = $tmplPath;

    // meta
    if (!isset($options['meta-http'])) {
      $options['meta-http'] = array();
    }
    if (!isset($options['meta-name'])) {
      $options['meta-name'] = array();
    }

    // css
    if (!isset($options['css'])) {
      $options['css'] = array();
    }

    // js
    if (!isset($options['js'])) {
      $options['js'] = array();
    }
    $phptal-&gt;options = $options;

    $result = '';
    try {
      $result = $phptal-&gt;execute();
    }
    catch (Kohana_Exception $e){
      throw new Kohana_Exception('phptal error');
    }

    return $result;
  }

  /*
   * Method: view
   *
   * Parameters:
   *  tmpl -
   *  data - title, any
   *  options - meta-http, meta-name, js, css
   *
   */
  function view($tmpl, $data, $options=array()) {
    echo $this-&gt;fetch($tmpl, $data, $options);
  }

} // End Ptal Class
</pre>
<p><span id="more-436"></span></p>
<p>■サンプル</p>
<p>コントローラ：/application/controllers/test.php</p>
<pre class="code">
&lt;?php defined('SYSPATH') or die('No direct script access.');

class Test_Controller extends Controller {

  function index()
  {
    $days[&quot;sun&quot;] = &quot;日曜日&quot;;
    $days[&quot;mon&quot;] = &quot;月曜日&quot;;
    $days[&quot;tue&quot;] = &quot;火曜日&quot;;
    $days[&quot;wed&quot;] = &quot;水曜日&quot;;

    $data[&quot;title&quot;] = &quot;PHPTALテスト&quot;;
    $data[&quot;days&quot;] = $days;
    $data[&quot;bol&quot;] = false;

    $options[&quot;meta-http&quot;] = array(&quot;pragma&quot; =&gt; &quot;no-cache&quot;);
    $options[&quot;meta-name&quot;] = array(&quot;keywords&quot; =&gt; &quot;テスト, test&quot;);
    $options[&quot;meta-name&quot;] = array(&quot;desctiption&quot; =&gt; &quot;これはテストです。&quot;);

    $options[&quot;css&quot;] = array(&quot;/css/test.css&quot;, &quot;/css/hoge.css&quot;);
    $options[&quot;js&quot;]  = array(&quot;/js/test.js&quot;, &quot;/js/hoge.js&quot;);

    $this-&gt;load-&gt;library(&quot;Ptal&quot;);
    $this-&gt;Ptal-&gt;view(&quot;test/index&quot;, $data, $options);
  }

}
</pre>
<p>共通テンプレート：/application/views/common/layout.html</p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
   &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;ja&quot; lang=&quot;ja&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Script-Type&quot; content=&quot;text/javascript&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Style-Type&quot; content=&quot;text/css&quot; /&gt;
&lt;tal:block repeat=&quot;m options/meta-http&quot;&gt;
&lt;meta http-equiv=&quot;${repeat/m/key}&quot; content=&quot;${m}&quot; /&gt;
&lt;/tal:block&gt;
&lt;tal:block repeat=&quot;m options/meta-name&quot;&gt;
&lt;meta name=&quot;${repeat/m/key}&quot; content=&quot;${m}&quot; /&gt;
&lt;/tal:block&gt;
&lt;title tal:content=&quot;title&quot;&gt;タイトル&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/default.css&quot; /&gt;
&lt;tal:block repeat=&quot;href options/css&quot;&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;${href}&quot; /&gt;
&lt;/tal:block&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/lib/jquery.js&quot;&gt;&lt;/script&gt;
&lt;tal:block repeat=&quot;src options/js&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;${src}&quot;&gt;&lt;/script&gt;
&lt;/tal:block&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;header&quot;&gt;
  &lt;p&gt;共通ヘッター&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;content&quot; metal:use-macro=&quot;${tmpl}/content&quot;&gt;
  コンテンツ
&lt;/div&gt;

&lt;div id=&quot;footer&quot;&gt;
  &lt;p&gt;共通フッター&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>テンプレート：/application/views/test/index.html</p>
<pre class="code">
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;レイアウト用&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;!-- ここから上はダミー --&gt;
    &lt;div id=&quot;content&quot; metal:define-macro=&quot;content&quot;&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;th&gt;キー&lt;/th&gt;
          &lt;th&gt;値&lt;/th&gt;
          &lt;th&gt;index&lt;/th&gt;
          &lt;th&gt;number&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr tal:repeat=&quot;day days&quot;&gt;
          &lt;td tal:content=&quot;repeat/day/key&quot;&gt;英字&lt;/td&gt;
          &lt;td tal:content=&quot;day&quot;&gt;曜日&lt;/td&gt;
          &lt;td tal:content=&quot;repeat/day/index&quot; /&gt;
          &lt;td tal:content=&quot;repeat/day/number&quot; /&gt;
        &lt;/tr&gt;
      &lt;/table&gt;

      &lt;p tal:condition=&quot;bol&quot;&gt;bolがtrueなら表示&lt;/p&gt;
      &lt;p tal:condition=&quot;not:bol&quot;&gt;bolがfalseなら表示&lt;/p&gt;
    &lt;/div&gt;
  &lt;!-- ここから下はダミー --&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>実行結果のソース</p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
   &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;ja&quot; lang=&quot;ja&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt;
&lt;meta http-equiv=&quot;Content-Script-Type&quot; content=&quot;text/javascript&quot;/&gt;
&lt;meta http-equiv=&quot;Content-Style-Type&quot; content=&quot;text/css&quot;/&gt;
&lt;meta http-equiv=&quot;pragma&quot; content=&quot;no-cache&quot;/&gt;
&lt;meta name=&quot;desctiption&quot; content=&quot;これはテストです。&quot;/&gt;
&lt;title&gt;PHPTALテスト / せつないぶろぐ&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/default.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/test.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/css/hoge.css&quot;/&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/lib/jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;/js/test.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;/js/hoge.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;header&quot;&gt;
  &lt;p&gt;共通ヘッター&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;content&quot;&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;th&gt;キー&lt;/th&gt;

          &lt;th&gt;値&lt;/th&gt;
          &lt;th&gt;index&lt;/th&gt;
          &lt;th&gt;number&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;sun&lt;/td&gt;
          &lt;td&gt;日曜日&lt;/td&gt;

          &lt;td&gt;0&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
        &lt;/tr&gt;&lt;tr&gt;
          &lt;td&gt;mon&lt;/td&gt;
          &lt;td&gt;月曜日&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;

          &lt;td&gt;2&lt;/td&gt;
        &lt;/tr&gt;&lt;tr&gt;
          &lt;td&gt;tue&lt;/td&gt;
          &lt;td&gt;火曜日&lt;/td&gt;
          &lt;td&gt;2&lt;/td&gt;
          &lt;td&gt;3&lt;/td&gt;

        &lt;/tr&gt;&lt;tr&gt;
          &lt;td&gt;wed&lt;/td&gt;
          &lt;td&gt;水曜日&lt;/td&gt;
          &lt;td&gt;3&lt;/td&gt;
          &lt;td&gt;4&lt;/td&gt;
        &lt;/tr&gt;      &lt;/table&gt;

            &lt;p&gt;bolがfalseなら表示&lt;/p&gt;    &lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;
  &lt;p&gt;共通フッター&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>ちょっとは使えるようになったかな？</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.setunai.net/20080131/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KohanaフレームワークでPHPTALを利用してみた</title>
		<link>http://blog.setunai.net/20080125/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f/</link>
		<comments>http://blog.setunai.net/20080125/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 16:28:53 +0000</pubDate>
		<dc:creator>t</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHPTAL]]></category>

		<guid isPermaLink="false">http://blog.setunai.net/20080125/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f/</guid>
		<description><![CDATA[新しくアプリを作ることになったのでKohanaフレームワークを試用中。 以前CakePHPを利用したときにDBと密過ぎて違和感を感じたのでもっと手軽感のあるフレームワークを探したらいきつたい。 最初はCodeIgnite [...]]]></description>
			<content:encoded><![CDATA[<p>新しくアプリを作ることになったのでKohanaフレームワークを試用中。<br />
以前CakePHPを利用したときにDBと密過ぎて違和感を感じたのでもっと手軽感のあるフレームワークを探したらいきつたい。</p>
<p>最初はCodeIgniter（以降CI）をちょっと試してみて良さそうだったのだけど<a href="http://www.oddwit.com/blog/2007/coming-to-hate-code-igniter">こちらの記事</a>を見て止めた。<br />
セッションデータをクッキーに入れるのはなんか嫌だ。</p>
<p>で、CIを調べていたときにKohanaフレームワークがある事を知っていたので調査してみる。<br />
CIから派生しただけあってデフォルトではクッキーに保存するのだけれど<br />
configの設定でdriverを&#8217;native&#8217;にすると通常のセッションが利用できそうだったので<strong>Kohana</strong>に決めた。</p>
<p>Kohanaにチャレンジして早速問題が。テンプレートエンジンが無い！<br />
CIも同じなんだけどKohanaもテンプレートにPHPタグ（&lt;?php ～ ?&gt;）を書いて変数にアクセスする。<br />
速度面で有利かも知れないけどやっぱりテンプレートエンジンは利用したい。</p>
<p>Smarty利用しようかとも思ったのだけれどそろそろ飽きたし調査ついでに新しいものに手をだすことにした。<br />
それで<strong>PHPTAL</strong></p>
<p>KohanaとPHPTALを連携するライブラリを書いたので晒します。</p>
<p>前提<br />
・Kohanaがセットアップされている<br />
・PHPTALがセットアップされている</p>
<p>■設定ファイルとライブラリ</p>
<p>/system/application/config/ptal.php</p>
<pre class="code">
&lt;?php defined('SYSPATH') or die('No direct access allowed.');
/*
 * File: Ptal
 *
 * Options:
 *  path     -
 *  suffix   -
 */
$config = array
(
&nbsp;&nbsp;&nbsp;&nbsp;'dir' =&gt; APPPATH.'views/',
&nbsp;&nbsp;&nbsp;&nbsp;'suffix' =&gt; '.html'
);
</pre>
<p>/system/libraries/Ptal.php（とりあえずレベルって事で^^;）</p>
<pre class="code">
&lt;?php if (!defined('SYSPATH')) exit('No direct script access.');
/*
 * Class: Ptal
 *
 *  author    - t@setunai.net
 *  license   -
 */
require &quot;PHPTAL.php&quot;;

class Ptal_Core {

&nbsp;&nbsp;&nbsp;&nbsp;protected static $config;

&nbsp;&nbsp;&nbsp;&nbsp;/*
&nbsp;&nbsp;&nbsp;&nbsp; * Constructor: __construct
&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;public function __construct()
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Load config
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self::$config = Config::item('ptal');
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;/*
&nbsp;&nbsp;&nbsp;&nbsp; * Method: fetch
&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;&nbsp;&nbsp;&nbsp; * Parameters:
&nbsp;&nbsp;&nbsp;&nbsp; *  tmpl -
&nbsp;&nbsp;&nbsp;&nbsp; *  data -
&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;&nbsp;&nbsp;&nbsp; * Returns:
&nbsp;&nbsp;&nbsp;&nbsp; *  fetch tmpl
&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;function fetch($tmpl, $data) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$dir = self::$config['dir'];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$suffix = self::$config['suffix'];

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$path = sprintf(&quot;%s%s%s&quot;, $dir, $tmpl, $suffix);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$phptal = new PHPTAL($path);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach($data as $p =&gt; $value) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$phptal-&gt;$p = $value;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = &quot;&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = $phptal-&gt;execute();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch (Kohana_Exception $e){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new Kohana_Exception('phptal error');
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $result;
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;/*
&nbsp;&nbsp;&nbsp;&nbsp; * Method: fetch
&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;&nbsp;&nbsp;&nbsp; * Parameters:
&nbsp;&nbsp;&nbsp;&nbsp; *  tmpl -
&nbsp;&nbsp;&nbsp;&nbsp; *  data -
&nbsp;&nbsp;&nbsp;&nbsp; *
&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;function view($tmpl, $data) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo $this-&gt;fetch($tmpl, $data);
&nbsp;&nbsp;&nbsp;&nbsp;}

} // End Ptal Class
</pre>
<p>■サンプル</p>
<p>コントローラ：/application/controllers/test.php</p>
<pre class="code">
&lt;?php defined('SYSPATH') or die('No direct script access.');

class Test_Controller extends Controller {

&nbsp;&nbsp;&nbsp;&nbsp;function index()
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$days[&quot;sun&quot;] = &quot;日曜日&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$days[&quot;mon&quot;] = &quot;月曜日&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$days[&quot;tue&quot;] = &quot;火曜日&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$days[&quot;wed&quot;] = &quot;水曜日&quot;;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data[&quot;title&quot;] = &quot;PHPTALテスト&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data[&quot;days&quot;] = $days;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$data[&quot;bol&quot;] = false;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;load-&gt;library(&quot;Ptal&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;Ptal-&gt;view(&quot;test/index&quot;, $data);
&nbsp;&nbsp;&nbsp;&nbsp;}
}
</pre>
<p>テンプレート：/application/views/test/index.html</p>
<pre class="code">
&lt;html&gt;
&lt;head&gt;
&lt;title tal:content=&quot;title&quot;&gt;タイトル&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;table&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;キー&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;値&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;index&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;number&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr tal:repeat=&quot;day days&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td tal:content=&quot;repeat/day/key&quot;&gt;英字&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td tal:content=&quot;day&quot;&gt;曜日&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td tal:content=&quot;repeat/day/index&quot; /&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td tal:content=&quot;repeat/day/number&quot; /&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/table&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;p tal:condition=&quot;bol&quot;&gt;bolがtrueなら表示&lt;/p&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;p tal:condition=&quot;not:bol&quot;&gt;bolがfalseなら表示&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>実行結果のソース</p>
<pre class="code">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;PHPTALテスト&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;table&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;キー&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;値&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;index&lt;/th&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;number&lt;/th&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;sun&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;日曜日&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;0&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;1&lt;/td&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;mon&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;月曜日&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;1&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;2&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;tue&lt;/td&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;火曜日&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;2&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;3&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;&lt;tr&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;wed&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;水曜日&lt;/td&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;3&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;4&lt;/td&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/tr&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/table&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;bolがfalseなら表示&lt;/p&gt;&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>PHPTAL初めて使ったけど良いね。<br />
テンプレートがすごく綺麗。</p>
<p>Kohana、PHPTALどちらも日本語情報少ないね。それが心配^^;</p>
<p>&#8212;-<br />
参考URL</p>
<p>Kohana<br />
<a href="http://kohanaphp.com/home.html">http://kohanaphp.com/home.html</a></p>
<p>PHPTAL<br />
<a href="http://phptal.motion-twin.com/">http://phptal.motion-twin.com/</a></p>
<p>CodeIgniter（日本CodeIgniterユーザ会）<br />
<a href="http://codeigniter.jp/">http://codeigniter.jp/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.setunai.net/20080125/kohana%e3%83%95%e3%83%ac%e3%83%bc%e3%83%a0%e3%83%af%e3%83%bc%e3%82%af%e3%81%a7phptal%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.345 seconds -->

