2
がここに私のディレクトリ構造である。このブロックタグのプラグインを読み込むことができませんはなぜSmartyのは
.PHPのSmartyを初期化するPHPコードは:
require_once('smarty31/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = getcwd() . '/templates';
$smarty->compile_dir = getcwd() . '/templates_c';
$smarty->plugins_dir[] = getcwd() . '/plugins';
プラグインのPHPコードは:
<?php
function smarty_block_sayhi($params, $content, $smarty, $open) {
if (!$open) {
return 'Hello: ' . $content;
}
}
?>
私が取得エラーメッセージはこれです:プラグインがsmarty31/libsに/ pluginsディレクトリの下にあったとき
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/mypath/phptests/templates/page.tpl" on line 11 "{sayhi}" unknown tag "sayhi"'
は、それが正常にロードされました。このサンプルコードはSmartyを正しく初期化していませんか?
「/mypath/phptests/templates/page.tpl」の内容は何ですか?あなたがそこに認識されないタグを持っているように見える – Alex
ワウスマイティ。それは過去からの爆発です。人々はまだそれを使用していますか? – Layke