有人说是重定义了,可我看不出来,代码不长,大家帮我看看吧,代码如下:
<?phpinclude("class.fasttemplate.php3");
include_once("DB.php");$DSN = "mysql://root:mysql520@localhost/guestbook";
$myDB = new DB;
$tpl = new FastTemplate("./templates");
$tpl->difine(array(main =>"index.tpl"));
$tpl->define_dynamic("row","main");$myOBJ = $myDB->connect($DSN);if ($myDB->isError($myOBJ))
{
echo $myOBJ;
return;
}$resultOBJ = $myOBJ->query("SELECT * FROM nervebook2");if ($myDB->isError($resultOBJ))
{
echo $resultOBJ;
return;
}
while ($row = $resultOBJ->fetchRow())
{
$tmpDate = array(substr($row[2],0,4),substr($row[2],4,2),substr($row[2],6,2));
$tmpDate = array(substr($row[2],8,2),substr($row[2],10,2),substr($row[2],12,2));
$date = implode("-",$tmpDate)." ". implode(":",$tmpDate);

$tpl->assign(NAME,$row[1]);
$tpl->assign(DATE,$date);
$tpl->assign(EMAIL,$row[3]);
$tpl->assign(HOMEPAGE,$row[4]);
$tpl->assign(MESSAGE,nl2br($row[5]));

$tpl->parse(ROWS,".row");

}$tpl->parse(BODY,"main");
$tpl->FastPrint("BODY");?>

解决方案 »

  1.   

    clear_parse方法被重复定义!
    这个FastTemplate是在php4.0.6及以前版本中使用的,不过他至今也没有再更新过搜索该文件,找到没有参数的clear_parse定义,并删除他
      

  2.   

    是重定义了啊
    clear_parse()
    在class.fasttemplate.php3 这个文件里
    fasttemplate刚用时是会报这个错的,我以前用也是的
    有两个clear_parse()
    注释掉一个就行了
      

  3.   

    把clear_parse()注解掉就好了,这个模板太老了,原来php的版本下使用没有什么问题建议用其他的 phplib smarttemplate smarty...
      

  4.   

    phplib smarttemplate smarty
    怎么用阿?
    我找不到php5的教材,用的是php4的教材,而我机子上装的是php5的环境,所以总是有各种各样的错误,一个小小的留言本折腾我好几天了,我把文件发上,大家帮我看看吧。templates/index.tpl
    <!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>nervebook2</title>
    <style type="text/css">
    <!--
    .STYLE1 { font-family: "宋体";
    font-size: 36px;
    color: #0000FF;
    }
    .STYLE4 {
    font-size: 18px;
    color: #0066FF;
    }
    -->
    </style>
    </head><body>
    <div align="center">
      <p class="STYLE1">访客留言本</p>
      
      <!BEGIN DYNAMIC BLOCK : row -->
      <table width="80%" border="1">
        <tr>
          <td width="50%">访客:NAME</td>
          <td width="50%">E-Mail:EMAIL</td>
        </tr>
        <tr>
          <td>日期:DATE</td>
          <td>HomePage:HOMEPAGE</td>
        </tr>
        <tr>
          <td colspan="2">MESSAGE</td>
        </tr>
      </table>
      <!END DYNAMIC BLOCK : row -->
      
      
      <p>&nbsp;</p>
      <form id="form1" name="form1" method="post" action="post.php">
        <table width="80%" border="1">
          <tr>
            <td colspan="2"><div align="center"><span class="STYLE4">*我要留言*</span></div></td>
          </tr>
          <tr>
            <td width="50%">访客</td>
            <td width="50%"><label>
              <input type="text" name="name" />
            </label></td>
          </tr>
          <tr>
            <td>E-Mail</td>
            <td><label>
              <input type="text" name="email" />
            </label></td>
          </tr>
          <tr>
            <td>HomePage</td>
            <td><label>
              <input type="text" name="homepage" />
            </label></td>
          </tr>
          <tr>
            <td>留言</td>
            <td><label>
              <textarea rows="5" name="message"></textarea>
    <br />
              <input type="submit" name="Submit" value="提交" />
              <input type="reset" name="Submit2" value="重置" />
              <br />
            </label></td>
          </tr>
        </table>
      </form>
      <p class="STYLE1">&nbsp;  </p>
    </div>
    </body>
    </html>index.php
    <?phpinclude("class.fasttemplate.php3");
    include_once("DB.php");$DSN = "mysql://root:mysql520@localhost/guestbook";
    $myDB = new DB;
    $tpl = new FastTemplate("templates/");
    $tpl->define(array(main => "index.tpl"));
    $tpl->define_dynamic("row","main");$myOBJ = $myDB->connect($DSN);if ($myDB->isError($myOBJ))
    {
    echo $myOBJ;
    return;
    }$resultOBJ = $myOBJ->query("SELECT * FROM nervebook2");if ($myDB->isError($resultOBJ))
    {
    echo $resultOBJ;
    return;
    }
    while ($row = $resultOBJ->fetchRow())
    {
    $tmpDate = array(substr($row[2],0,4),substr($row[2],4,2),substr($row[2],6,2));
    $tmpDate = array(substr($row[2],8,2),substr($row[2],10,2),substr($row[2],12,2));
    $date = implode("-",$tmpDate)." ". implode(":",$tmpDate);

    $tpl->assign(NAME, $row[1]);
    $tpl->assign(DATE, $date);
    $tpl->assign(EMAIL, $row[3]);
    $tpl->assign(HOMEPAGE, $row[4]);
    $tpl->assign(MESSAGE, nl2br($row[5]));

    $tpl->parse(ROWS,".row");

    }$tpl->parse(BODY, "main");
    $tpl->FastPrint("BODY");?>post.php
    <?phpinclude_once("DB.php");$date = date("Y-m-d H:i:s");
    $DSN = "mysql://root:mysql520@localhost/guestbook";
    $myDB = new DB;$myOBJ = $myDB->connect($DSN);if ($myDB->isError($myOBJ))
    {
    echo $myOBJ;
    return;
    }
    $sql = "INSERT INTO nervebook2 (name, date, email, homepage, message) VALUES('$_POST[name]','$_POST[date]','$_POST[email]','$_POST[homepage]','$_POST[message]')";
    $rusultOBJ = $myOBJ->query($sql);
    if ($myDB->isError($resultOBJ))
    {
    echo $resultOBJ;
    }else {
    header("Location: index.php");
    }?>还有class.FastTemplate.php3和post.php大家知道的,另外表就一张,大家看得出来的,
    大家帮我看看到底还有哪里有错,小弟不胜感激!
      

  5.   

    我也用过这个fasttemplate杂class.fasttemplate.php3文件里有两个clear_parse(),删掉一个就可以了
      

  6.   

    小弟在线等救星来拯救我
    大家也可以把文件下了去看,地址是
    http://www.tiantiansoft.com/bbs/viewFile.asp?BoardID=128&ID=13987
    谢谢大家了
      

  7.   

    http://www.tiantiansoft.com/bbs/dispbbs.asp?BoardID=128&ID=121698&replyID=&skin=1
    是这个地址..