zoukankan      html  css  js  c++  java
  • 如何解决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定界符冲突导致的。

    解决办法有两个:

    1.可以把 smarty 的定界符设成 <{ }>

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

    2.可以用smarty的literal处理,可以把JS代码包含在{literal}{/literal}之间就可以了。

    {literal}
        $ (
            function () { alert ('培训课程')}
        );
    {/literal}



  • 相关阅读:
    function函数
    for的衍生对象
    前端发展史
    字符串替换
    正则
    DOM和BOM的区别与联系
    BOM
    DOM
    css单位分析
    API and Web API
  • 原文地址:https://www.cnblogs.com/moqiang02/p/4061610.html
Copyright © 2011-2022 走看看