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

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

 2016-05-07 10:28

我想在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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值