首頁  >  文章  >  web前端  >  解決css和js的{}與smarty定界符衝突問題的兩種方法_javascript技巧

解決css和js的{}與smarty定界符衝突問題的兩種方法_javascript技巧

WBOY
WBOY原創
2016-05-16 17:22:571123瀏覽

當輸入url位址後網頁出現:Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "E:wampwwwcmssystem/templates/index.html" on line 79 "$("#job").load(". /system/templates/touch/test.php",{catid:3});" - Unexpected ":", expected one of: "}" , " "' in E:wampwwwcmssystemSmartysyspluginssmarty_internal_templatecompilerbase.php on line 441這樣的問題,通常是css和js的{}與smarty定界符衝突所導致的。

解決方法有兩個:

1.可以把smarty 的定界符設為

複製程式碼 程式碼如下:

$tpl->left_delimiter = '$tpl->right_delimiter = '}> ';

2.對於js的{}與smarty定界符衝突,可以用smarty的literal處理,可以把JS程式碼包含在{literal}{/literal}之間就可以了。
複製程式碼 程式碼如下:


$ ( > function () { alert ('訓練課程')}
);


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn