<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>{$name}</title><body><!-- Copyright ?2005. Spidersoft Ltd -->
<style type="text/css">
A.applink:hover {border: 2px dotted #DCE6F4;padding:2px;background-color:#ffff00;color:green;text-decoration:none}
A.applink       {border: 2px dotted #DCE6F4;padding:2px;color:#2F5BFF;background:transparent;text-decoration:none}
A.info          {color:#2F5BFF;background:transparent;text-decoration:none}
A.info:hover    {color:green;background:transparent;text-decoration:underline}
</style>html模版里写了一段style就出错
Fatal error: Smarty error: [in index.html line 12]: syntax error: unrecognized tag: border: 2px dotted #DCE6F4;padding:2px;background-color:#ffff00;color:green;text-decoration:none (Smarty_Compiler.class.php, line 446) in D:\www\phpnew\common\smarty\Smarty.class.php on line 1095
取出style后就没有问题 why

解决方案 »

  1.   

    把CSS代码放在{literal}{/literal}之间或者,修改Smarty的默认定界符{}或者,把CSS写在.css文件,引入暂时想到这几个办法
      

  2.   

    因为你smarty的标签 {} 和style 里面{}的重复了,执行到style里{}里的内容smarty会去处理,你可以更改smarty的左右标签为 <{  }>或者其他与html不冲突的都行
      

  3.   

    对,楼上说的都对的,smarty的核心就是匹配,所以你的边界标签要用<{}>原因是你在style中用{},你的边界标签也是{}所以会出错。