首页  >  文章  >  后端开发  >  Fatal error: Smarty error:syntax error: unrecognized tag,该怎么解决

Fatal error: Smarty error:syntax error: unrecognized tag,该怎么解决

WBOY
WBOY原创
2016-06-13 13:13:291018浏览

Fatal error: Smarty error:syntax error: unrecognized tag
求助,代码如下,模板文件Login.tpl中,
<script><br />function create_code(){<br /> document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;<br />}<br /></script>

一直报错:“Fatal error: Smarty error: [in Login.tpl line 93]: syntax error: unrecognized tag: document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000; (Smarty_Compiler.class.php, line 446) in I:\masterPHP\vtigercrm\Smarty\libs\Smarty.class.php on line 1095

求各位大神指导!!!

------解决方案--------------------
smarty 的 tpl 里面 要直接写 javascript 或 style 要用 literal 标签 包起来
例:

HTML code
{literal}
<script>
function create_code(){
    document.getElementByIdx_x("code").src = 'create_code.php?'+Math.random()*10000;
}
</script>
{/literal} <div class="clear">
                 
              
              
        
            </div>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn