摸板
<!-- BEGIN message -->
<div style="width:100%;clear:both;height:auto;">
<div style="float:left;width:60%;padding-top:2px;">发布ip:{ip} 发布时间:{time} 评论内容:</div>
<div style="float:right;width:40%;text-align:right;padding-top:2px;"><a href="#" onclick="newwin('addpcomment.php?mid={mid}');return false;">回复此评论</a></div>
</div>
<div style="background-color:#D6E8EB;padding:8px 20px;"><br/>{comment}
<!-- BEGIN submessage --><br/>
<div style="float:left;width:60%">发布ip:{sip} 发布时间:{stime} 评论内容:</div>
<div>{scomment}</div>
<!-- END submessage -->
</div>
<br/>
<!-- END message -->
代码
<?php
$comments = readComment($_GET['products_id']);
if($comments)
{
$tpl->set_block('main','message','messages');
$tpl->set_block('message','submessage','submessages');
foreach($comments as $key=>$comment)
{
$tpl->set_var('ip',preg_replace('/.[^.]*$/','.*',long2ip($comment['m_ip'])));
$tpl->set_var('time',date('Y-m-d H:i:s',$comment['m_time']));
$tpl->set_var('comment',htmlspecialchars($comment['m_msg']));
$tpl->set_var('mid',$comment['m_id']);
//
$submessages = readPComment($comment['m_id']);
if($submessages)
{
//print_r($submessages);
foreach($submessages as $k=>$submessage)
{
$tpl->set_var('sip',long2ip($submessage['m_ip']));
$tpl->set_var('stime',date('Y-m-d H:i:s',$submessage['m_time']));
$tpl->set_var('scomment',htmlspecialchars($submessage['m_msg']));
$tpl->parse('submessages','submessage',true);
}
unset($submessages);
}
$tpl->parse("messages", "message", true);
unset($comment);
}
}
php?>
这样写不对哦..
第一条评论应该是没有回复的....
有谁知道该怎么写吗 ?