Smartyの{php}タグ内からPHPでアサインした変数値を取出すには
<?php require_once('lib/smarty/Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = TEMPLATE_PATH; $smarty->compile_dir = SMARTY_TEMPL_C; $smarty->assign("item_code", "12345"); $smarty->display("template.tpl"); ?>
テンプレート「template.tpl」内からアサインされた"item_code"へアクセスする例↓
{php} $item_code_var = $this->get_template_vars("item_code"); print($item_code_var); {/php}
んで結果は
12345
となる