首页 新闻 会员 周边

在用smarty包含的tpl文件中写php的问题

0
[待解决问题]

<{include file="inco/header.tpl" title="首页" description="首页描述" keywords="首页关键字" getCSS='base,admin'}>
<{php}>

<{/php}>
<script type="text/javascript" src="<{$www_root}>/js/LAB.min.js"></script>
<{include file="inco/footer.tpl"}>

 

我在tpl里写了

<{php}>

<{/php}>

就报错了。

 

报错信息:

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template &quot;..\tpl\index.tpl&quot; on line 3 &quot;&lt;{php}&gt;&quot; unknown tag &quot;php&quot;' in D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templatecompilerbase.php:667 Stack trace: #0 D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templatecompilerbase.php(453): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "ph...', 3) #1 D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('php', Array) #2 D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r37() #3 D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(37) #4 D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(10, '??dsdfsd???') #5 D:\wamp\www\6rooms\libs\sysplugins\smar in D:\wamp\www\6rooms\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 667

 

 

感觉是把两个尖括号转义了。应该怎么办?

问题补充:

是smarty的版本问题。高版本的smarty把这个功能去掉了。毕竟这样的写法不好。用smarty就是为了把php代码和html代码分开,这样写的话又合在一起了。

 

Smarty-2.6.27 是支持这种写法的。。

snowinmay的主页 snowinmay | 菜鸟二级 | 园豆:240
提问于:2013-08-02 09:25
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册