先上列表的查询代码:
//留言板
$comments=array();
$cts=DB::query("SELECT * FROM ".DB::table("home_comment")." WHERE `id` = $_GET[uid] ORDER BY `dateline` DESC LIMIT 0,10");
while ($ct=DB::fetch($cts)) {
$comments[]=$ct;
}
html
<script src="static/js/home.js" type="text/javascript"></script>
<div class="panel panel-default" id="div_main_content">
<div class="panel-heading">留言板</div>
<div class="panel-body">
<form id="quickcommentform_{$_GET[uid]}" action="home.php?mod=spacecp&ac=comment" method="post" autocomplete="off" onsubmit="ajaxpost('quickcommentform_{$_GET[uid]}', 'return_qcwall_$_GET[uid]');doane(event);">
<div class="tedt mtn mbn">
<div class="area">
<!--{if $_G['uid'] || $_G['group']['allowcomment']}-->
<textarea id="comment_message" onkeydown="ctrlEnter(event, 'commentsubmit_btn');" name="message" rows="5" class="pt" placeholder="有事儿就给我留言吧"></textarea>
<!--{elseif $_G['connectguest']}-->
<div class="pt hm">{lang connect_fill_profile_to_comment}</div>
<!--{else}-->
<div class="pt hm">登陆后可发表留言 <a href="member.php?mod=logging&action=login" onclick="showWindow('login', this.href)" class="xi2">{lang login}</a> | <a href="member.php?mod={$_G[setting][regname]}" class="xi2">$_G['setting']['reglinkname']</a></div>
<!--{/if}-->
</div>
</div>
<p>
<input type="hidden" name="referer" value="home.php?mod=space&uid={$_GET[uid]}&do=wall" />
<input type="hidden" name="id" value="$_GET[uid]" />
<input type="hidden" name="idtype" value="uid" />
<input type="hidden" name="handlekey" value="qcwall_{$_GET[uid]}" />
<input type="hidden" name="commentsubmit" value="true" />
<input type="hidden" name="quickcomment" value="true" />
<button type="submit" name="commentsubmit_btn" value="true" id="commentsubmit_btn" class="btn btn-block btn-default"><strong>发表</strong></button>
<span id="return_qcwall_{$_GET[uid]}"></span>
</p>
<input type="hidden" name="formhash" value="{FORMHASH}" />
</form>
</div>
<div id="comment">
<ul class="list-group" id="comment_ul">
<!--{loop $comments $value}-->
<a name="comment_anchor_$value[cid]"></a>
<dl id="comment_$value[cid]_li" class="bbda cl">
<!--{if $value[author]}-->
<dd class="m avt"><a href="home.php?mod=space&uid=$value[authorid]" c="1"><!--{avatar($value[authorid],small)}--></a></dd>
<!--{else}-->
<dd class="m avt"><img src="{STATICURL}image/magic/hidden.gif" alt="hidden" /></dd>
<!--{/if}-->
<dt>
<span class="y xw0">
<!--{if $value['authorid'] != $_G['uid'] && $value['author'] == "" && $_G[magic][reveal]}-->
<a id="a_magic_reveal_{$value[cid]}" href="home.php?mod=magic&mid=reveal&idtype=cid&id=$value[cid]" onclick="ajaxmenu(event,this.id,1)"><img src="{STATICURL}image/magic/reveal.small.gif" alt="reveal" />{$_G[magic][reveal]}</a>
<span class="pipe">|</span>
<!--{/if}-->
<!--{hook/global_space_comment_op $k}-->
<!--{if $_G['setting']['magicstatus']}-->
<!--{if $value[authorid]==$_G[uid] && !empty($_G['setting']['magics']['flicker'])}-->
<img src="{STATICURL}image/magic/flicker.small.gif" alt="flicker" class="vm" />
<!--{if $value[magicflicker]}-->
<a id="a_magic_flicker_{$value[cid]}" href="home.php?mod=spacecp&ac=magic&op=cancelflicker&idtype=cid&id=$value[cid]&handlekey=cfhk_{$value[cid]}" onclick="showWindow(this.id, this.href, 'get', 0)">{lang cancel}{$_G['setting']['magics']['flicker']}</a>
<!--{else}-->
<a id="a_magic_flicker_{$value[cid]}" href="home.php?mod=magic&mid=flicker&idtype=cid&id=$value[cid]" onclick="showWindow(this.id, this.href, 'get', 0)">{$_G['setting']['magics']['flicker']}</a>
<!--{/if}-->
<span class="pipe">|</span>
<!--{/if}-->
<!--{if $value[authorid]==$_G[uid] && !empty($_G['setting']['magics']['anonymouspost']) && $value[author]}-->
<img src="{STATICURL}image/magic/anonymouspost.small.gif" alt="flicker" class="vm" />
<a id="a_magic_anonymouspost_{$value[cid]}" href="home.php?mod=magic&mid=anonymouspost&idtype=cid&id=$value[cid]" onclick="showWindow(this.id, this.href, 'get', 0)">{$_G['setting']['magics']['anonymouspost']}</a>
<span class="pipe">|</span>
<!--{/if}-->
<!--{if !empty($_G['setting']['magics']['namepost']) && !$value[author]}-->
<img src="{STATICURL}image/magic/namepost.small.gif" alt="flicker" class="vm" />
<a id="a_magic_namepost_{$value[cid]}" href="home.php?mod=magic&mid=namepost&idtype=cid&id=$value[cid]" onclick="showWindow(this.id, this.href,'get', 0)">{$_G['setting']['magics']['namepost']}</a>
<span class="pipe">|</span>
<!--{/if}-->
<!--{/if}-->
<!--{if $_G[uid]}-->
<!--{if $value[authorid]==$_G[uid]}-->
<a href="home.php?mod=spacecp&ac=comment&op=edit&cid=$value[cid]&handlekey=editcommenthk_{$value[cid]}" id="c_$value[cid]_edit" onclick="showWindow(this.id, this.href, 'get', 0);">{lang edit}</a>
<!--{/if}-->
<!--{if $value[authorid]==$_G[uid] || $value[uid]==$_G[uid] || checkperm('managecomment')}-->
<a href="home.php?mod=spacecp&ac=comment&op=delete&cid=$value[cid]&handlekey=delcommenthk_{$value[cid]}" id="c_$value[cid]_delete" onclick="showWindow(this.id, this.href, 'get', 0);">{lang delete}</a>
<!--{/if}-->
<!--{/if}-->
<!--{if $value[authorid]!=$_G[uid] && ($value['idtype'] != 'uid' || $space[self]) && $value[author]}-->
<a href="home.php?mod=spacecp&ac=comment&op=reply&cid=$value[cid]&feedid=$feedid&handlekey=replycommenthk_{$value[cid]}" id="c_$value[cid]_reply" onclick="showWindow(this.id, this.href, 'get', 0);">{lang reply}</a>
<!--{/if}-->
<!--{if checkperm('managecomment')}-->
<span class="xg1 xw0">IP: $value[ip]</span>
<!--{/if}-->
<!--a href="home.php?mod=spacecp&ac=common&op=report&idtype=comment&id=$value[cid]&handlekey=reportcommenthk_{$value[cid]}" id="a_report_$value[cid]" onclick="showWindow(this.id, this.href, 'get', 0);">{lang report}</a-->
</span>
<!--{if $value[author]}-->
<a href="home.php?mod=space&uid=$value[authorid]" id="author_$value[cid]">{$value[author]}</a>
<!--{else}-->
$_G[setting][anonymoustext]
<!--{/if}-->
<span class="xg1 xw0"><!--{date($value[dateline])}--></span>
<!--{if $value[status] == 1}--><b>({lang moderate_need})</b><!--{/if}-->
</dt>
<dd id="comment_$value[cid]"{if $value[magicflicker]} class="magicflicker"{/if}><!--{if $value[status] == 0 || $value[authorid] == $_G[uid] || $_G[adminid] == 1}-->$value[message]<!--{else}--> {lang moderate_not_validate} <!--{/if}--></dd>
<!--{hook/global_comment_bottom}-->
</dl>
<!--{/loop}-->
</ul>
</div>
<div class="panel-footer more">
<a target="_blank" rel="nofollow" href="#">More ++</a>
</div>
</div>