zblogPHP主题首页留言功能的代码

我想在zblogPHP上面做功能留言,这个问题一直考虑了好今天,还是没能完美的实现。现在的问题就是index.php首页上面无法调用comments.php这个文件,因为zblogPHP默认的index.php是没有ID的,所以无法留言。

这里要感谢Mike.Cao给的代码,虽然没尝试成功,不过我还是记录下。看看能否继续实现。下面是代码:

<div class="section">
    {php}
    $post = New Post;
    $post->LoadInfoByID($postid);
    $page = $page == 0 ? 1 : $page;
    $pagebar = new Pagebar('javascript:GetComments(\'' . $post->ID . '\',\'{%page%}\')');
    $pagebar->PageCount = $zbp->commentdisplaycount;
    $pagebar->PageNow = $page;
    $pagebar->PageBarCount = $zbp->pagebarcount;
    {/php}
    <label id="AjaxCommentBegin"></label>
    <div class="comments">
        <aside class="comment-list">
            {php}
            $comments = array();
            $comments = $zbp->GetCommentList('*',array(array('=', 'comm_LogID', $post->ID),array('=', 'comm_RootID', 0),array('=', 'comm_IsChecking', 0),),
            array('comm_ID' => ($zbp->option['ZC_COMMENT_REVERSE_ORDER'] ? 'DESC' : 'ASC')),
            array(($pagebar->PageNow - 1) * $pagebar->PageCount, $pagebar->PageCount),
            array('pagebar' => $pagebar)
            );
            $rootid = array();
            foreach ($comments as $comment) {
            $rootid[] = array('comm_RootID', $comment->ID);
            }
            $comments2 = $zbp->GetCommentList('*',array(array('=', 'comm_LogID', $post->ID),array('array', $rootid),array('=', 'comm_IsChecking', 0),),array('comm_ID' => ($zbp->option['ZC_COMMENT_REVERSE_ORDER'] ? 'DESC' : 'ASC')),null,null);
            $floorid = ($pagebar->PageNow - 1) * $pagebar->PageCount;
            foreach ($comments as &$comment) {
            $floorid += 1;
            $comment->FloorID = $floorid;
            $comment->Content = TransferHTML($comment->Content, '[enter]') . '<label id="AjaxComment' . $comment->ID . '"></label>';
            }
            foreach ($comments2 as &$comment) {
            $comment->Content = TransferHTML($comment->Content, '[enter]') . '<label id="AjaxComment' . $comment->ID . '"></label>';
            }
            {/php}
            <!--评论输出-->
            {foreach $comments as $key => $comment}
            {template:comment}
            {/foreach}
        </aside>
        <!--评论翻页条输出-->
        <div class="comments-pagebar">
            {template:pagebar}
        </div>
    </div>
    <label id="AjaxCommentEnd"></label>
</div>
转载请说明出处内容投诉
zblog资源网 » zblogPHP主题首页留言功能的代码

发表评论

欢迎 访客 发表评论

加入会员,享受更优质的zblog技术服务!

马上加入 会员说明 联系客服