タグ

2008年7月22日のブックマーク (2件)

  • ninnin.net blog: SmartyでSJISを使う

    SmartyでSJISを使う SmartyではSJIS(Shift_JIS)はそのままでは使えない。 なぜならば、Smartyの標準のデリミタである「{」(0x007b)と「}」(0x007d)をSJIS文字列が含んでしまっていることがあるからだ。 (つまり必ずしもエラーにはならないので注意) エラーが起こった場合は次のようなメッセージが表示される。 Fatal error: Smarty error: [in path/to/tpl.html line 10]: syntax error: unrecognized tag: ‹ (Smarty_Compiler.class.php, line 439) in /path/to/Smarty/Smarty.class.php on line 1095 これを回避するには、主に次の2つの方法がある。 1.デリミタを変更する 波カッ

    unieye51
    unieye51 2008/07/22
    ninnin.net blog: SmartyでSJISを使う
  • SmartyでSJISのテンプレートを使う « kawama.jp

    「Smarty SJIS」でググるといくつか有益な情報が引っかかるので、それを見て簡単に対応できました。 もっとも、途中でSmartyとは1%も関係ないところでつまづいてしまって無駄に時間を使ってしまったのですが。。。 下記の例だと、plugins_dirにprefilter.pre01.phpとpostfilter.post01.phpのファイルを設置。autoload_filtersを使って自動でフィルタがかかるようにしています。 体 require("/path/to/smarty"); $smarty = new Smarty; $smarty->template_dir = "/path/to/template_dir"; $smarty->compile_dir = "/path/to/compile_dir"; $smarty->plugins_dir = "/path/t