求助文章分页 文章内容输出Array

浏览:634 发布日期:2014/06/30 分类:求助交流
    $id=intval ( $_GET ['aid'] );
        if (isset ( $_GET ['p'] ) && $_GET ['p'] != '') {
            $p = intval ( $_GET ['p'] );
        }
            $Form   =   M('content');
            $result = $Form->where('articleId='.$id.'')->select();
            $cut='_ueditor_page_break_tag_';
            $CONTENT_POS = strpos ( $result[0] ['content'], $cut );//判断是否存在分页
            if ($CONTENT_POS !== false) {
                $p = ($p === 1) ? 0 : ($p - 1) * 1;
                $contents = array_filter ( explode ( $cut, $result[0] ['content'] ) ); //按分页标记分段
                $pagenumber = count ( $contents ); //分页数
                $page=new Page($pagenumber ,1);
                $show=$page->show();    
                $result[0] ['content']  =array_slice( $contents , $p,1);//将整个文章内容替换为分页内容
                $this->assign('page',$show);
            }

     $this->assign('result', $result);
    $this->display();
模板里调用:<volist name="result" id="result">{$result.content} </volist>
<br/> {$page}    
后台添加的文章内容:<p>
    测试
</p>_ueditor_page_break_tag_
<p>
    测试
</p>_ueditor_page_break_tag_
<p>
    测试
</p>
生成后的页面:
Array
3 条记录 3/3 页 上一页 123

这是什么情况呢?
最佳答案
评论( 相关
后面还有条评论,点击查看>>