Home > Backend Development > PHP Tutorial > Fatal error: Smarty error:syntax error: unrecognized tag,该怎么解决

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

WBOY
Release: 2016-06-13 13:13:29
Original
1073 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template