パンプキンスパイスラテ

IT系のことが多めの日記帳です

Smartyのディレクトリ構成について

まぁ、rewrite_moduleを使えばいいのかもしれないけど。
使わない場合、アクセスするファイルとテンプレートの表示ファイルを同じようにディレクトリ分けすると、下記の部分のパスもそれに合わせて変えなきゃいけなくて面倒。
ディレクトリ構成

<?php
require_once('smarty/Smarty.class.php');
$o_smarty = new Smarty;
$o_smarty->template_dir="./templates/";
$o_smarty->compile_dir="./templates_c/";
$o_smarty->config_dir="./configs/";
$o_smarty->cache_dir="./cache/";
?>

または、

<?php
require_once('smarty/Smarty.class.php');
$o_smarty = new Smarty;
$o_smarty->template_dir="../templates/";
$o_smarty->compile_dir="../templates_c/";
$o_smarty->config_dir="../configs/";
$o_smarty->cache_dir="../cache/";
?>

パス指定に「/」の絶対パスが指定できないみたいで、階層が深くなるたびに、「../」を追加しなきゃならない。だから上記部分をまとめて別ファイルにしてインクルードしようとしてもダメだった。
みんなどうしてるのかなぁ。
まぁ、rewrite_moduleを使えばいいのかもしれないけど。