- 时间:2020-06-25 06:26 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:解决css和js的{}与smarty定界符冲突问题的两种方法
当输入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定界符冲突导致的。
[b]解决办法有两个:[/b]
1.可以把 smarty 的定界符设成 <{ }>
$tpl->left_delimiter = '<{';
$tpl->right_delimiter = '}>';
2.对于js的{}与smarty定界符冲突,可以用smarty的literal处理,可以把JS代码包含在{literal}{/literal}之间就可以了。
<{literal}>
$ (
<span style="white-space:pre"> </span>function () { alert ('培训课程')}
);
<{/literal}>