私はphp smartyタグを含むhtmlページを持っています。問題は、{literal}
javascript と css コード ブロックをエスケープするために必要なタグです。php 5.3 や 5.5 など、他の多くの php バージョンでは問題なく動作しますが、php 5.4.9 では動作しません。
{literal}
以下のように、JavaScriptをエスケープするために使用する場合:
<script type="text/javascript">
{literal}
$(function () {
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
if (!$.support.placeholder) {
$('.field').find ('label').show ();
}
});
{/literal}
</script>
を取得し、"Fatal error: Smarty error: [in login.html line 70]: syntax error: unrecognized tag: php' . str_repeat(" ", substr_count('{literal (Smarty_Compiler.class.php, line 446) in /var/www/library/smarty/Smarty.class.php on line 1095"
70行目がコード{literal}
です。
{literal}
しかし、タグを削除して使用する{ldelim}
と{rdelim}
、次のように正常に機能します。
<script type="text/javascript">
$(function () {ldelim}
jQuery.support.placeholder = false;
test = document.createElement('input');
if('placeholder' in test) jQuery.support.placeholder = true;
if (!$.support.placeholder) {ldelim}
$('.field').find ('label').show ();
{rdelim}
{rdelim});
</script>
{literal}
プロジェクト内のすべてのタグを解決策として変更する{ldelim}
とは考えて{rdelim}
いません{literal}
.