![](http://oshiete.xgoo.jp/images/v2/pc/qa/question_title.png?8acaa2e)
smarty3 でエラーが発生しています。
現在自宅のサーバーでsmarty3を勉強しているのですが以下のエラーで困っています。
詳しい方ご教授お願いします。
環境 :
CentOS 6.3
PHP 5.3.3
Smarty 3.1.13
読み込んでいるファイル
test.php
1 <?php
2 ini_set('display_errors', 1);
3 ini_set('date.timezone','Asia/Tokyo');
4 define('SMARTY_DIR', 'Smarty/libs/');
5 require_once( SMARTY_DIR. 'Smarty.class.php');
6
7 $smarty = new Smarty();
8
9 $smarty->template_dir = '../templates/';
10 $smarty->compile_dir = '../templates_c/';
11 $smarty->config_dir = '../config/';
12 $smarty->cache_dir = '../cache/';
13
14 $msg = "テストを表示します";
15 $smarty->assign('msg', $msg);
16
17 $smarty->display('test.tpl');
18
19
20 ?>
テンプレートファイル
1 <html>
2 {$msg}
3 </html>
表示されるエラー文
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "../templates/test.tpl" on line 2 "{$msg}" unknown tag "private_print_expression"' in /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php:665 Stack trace: #0 /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php(451): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "pr...', 2) #1 /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templateparser.php(2353): Smarty_Internal_TemplateCompilerBase->compileTag('private_print_e...', Array, Array) #2 /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r27() #3 /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(27) #4 /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_intern in /usr/local/lib/php/includes/Smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 665
テンプレートファイルの{$msg}を削除して動作させるとコンパイルされてはいるようです。
よろしくお願いします。
A 回答 (2件)
- 最新から表示
- 回答順に表示
No.2
- 回答日時:
以下の事例が現象(というかエラーメッセージ)が似てるな
http://www.smarty.net/forums/viewtopic.php?p=69968
『なんてこった、サーバ上の「templates_c」ディレクトリにパーミンション777を設定してみたんだ。そしたらちゃんと動いた』
だと。
>テンプレートファイルの{$msg}を削除して動作させるとコンパイルされてはいるようです。
という事なので、現象は違うかも知れないが…念のためパーミッションの確認を。
他にも、『/libs/sysplugins ディレクトリをちゃんとアップしてないか、パーミッションの関係で読みとれてないんじゃねえの?』と推測している人も居るようなので、その点も確認してみてください。
No.1
- 回答日時:
>9 $smarty->template_dir = '../templates/';
>10 $smarty->compile_dir = '../templates_c/';
>11 $smarty->config_dir = '../config/';
>12 $smarty->cache_dir = '../cache/';
原因はこれ。
どうしてこの部分かは、日本語のリファレンスと英語のリファレンスを見比べると
どうしてかがわかる。
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
似たような質問が見つかりました
- その他(プログラミング・Web制作) カラーミーのSmarty構文について 1 2022/10/09 13:55
- PHP カラーミーショップのSmartyでの文字列抜き出し 2 2022/05/06 11:51
- その他(プログラミング・Web制作) mariadbでのエラー 1 2022/11/15 12:31
- JavaScript カラーミーショップのsectionループ内で、[引数][戻り値]ありの関数的な処理を行いたいです。 1 2022/05/07 19:39
- その他(プログラミング・Web制作) python 2 2022/12/23 09:06
- PostgreSQL PostgreSQL14.6のSSL対応について 1 2023/01/05 15:42
- オープンソース Vue+Laravelのデザインテンプレートのサンプルが起動できない 1 2022/05/18 21:52
- UNIX・Linux postfix smtpサーバーリレーがTLSハンドシェーク失敗 1 2022/08/15 15:45
- Ruby Ruby / passenger のインストールについて 1 2023/01/30 18:31
- その他(プログラミング・Web制作) python flask から fastapiへの移行時のエラー対処 1 2023/02/05 12:26
関連するカテゴリからQ&Aを探す
おすすめ情報
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
tplを読みに行けません。
-
PHPの関数って何種類ありますか?
-
Pleskサーバ利用時にSmartyのas...
-
Smartyのテンプレート
-
フォントの色を変えるには?
-
【BAT(バッチ)ファイル】Web...
-
PHP8を使うと、大量のWarningが...
-
バッチを用いたフォルダの自動移動
-
ファイル一覧を表示しその画面...
-
文字化けについて
-
PHPのif文でその処理を途中で抜...
-
eclipseのエラーの意味
-
透過PNGが透過されない!!
-
空メールの作り方教えて欲しい...
-
3つ以上の論理積は利用可能なの...
-
fopenでファイルが開かない場合...
-
PHPのstrpbrk関数ってひらがな...
-
move_uploaded_fileのエラーについ
-
Apache(Ver 2.4.4)の設...
-
is_callable()の第二引数の使い方
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
Smartのカスタマイズでエラー
-
Smarty tpl内のifの書き方について
-
phpでサブルーチン
-
smarty3で変数表示について
-
smartyテンプレート読み込みに...
-
PHPの関数って何種類ありますか?
-
PHPでのページ送り機能
-
PHPフレームワーク環境でのSmar...
-
これからのPHP開発ではPDOを選...
-
PHPってなんの略?
-
xserver Smarty PHP+MySQL
-
Smartyのテンプレート
-
PHP+Smarty+MySQLで、データベ...
-
HTML、CSS、PHPに便利なテキス...
-
【php】動的なURLを静的に見せ...
-
Pleskサーバ利用時にSmartyのas...
-
perlとphpの共用?
-
phpで距離÷時間の方法
-
フォントの色を変えるには?
-
onedrive にexcelファイルをア...
おすすめ情報