IT俱乐部-城北日常经验分享

浏览: 2736    评论: 0

杰奇首页调用指定小说最新章节的代码标签,拿去用吧。不用谢谢


<?php

/**

 * 章节列表区块

 *

 * 可以根据参数指定显示指定小说ID,的最近N章节

 * 

 * 调用模板:/modules/article/templates/blocks/block_chapterlist.html

 * 

 * @category   jieqicms

 * @package    article

 * @copyright  Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://it-club.cn)

 * @author     $Author: Hulihutu $

 * @version    $Id: block_chapterlist.php 332 2009-02-23 09:15:08Z juny $

 */


class BlockArticleChapterlist extends JieqiBlock

{

var $module = 'article';

var $template = 'block_chapterlist.html';

var $exevars=array('bookid'=>'0', 'listnum'=>48);  //执行配置

//listnum 显示章节数

//bookid 指定书号


function BlockArticleChapterlist(&$vars){

global $jieqiArticleuplog;

$this->JieqiBlock($vars);

if(!empty($this->blockvars['vars'])){

$varary=explode(',', trim($this->blockvars['vars']));

$arynum=count($varary);

if($arynum>0){

$varary[0]=trim($varary[0]);

$this->exevars['bookid']=$varary[0];

}


if($arynum>1){

$varary[1]=trim($varary[1]);

$this->exevars['listnum']=$varary[1];

}

}

$this->blockvars['cacheid']=md5(serialize($this->exevars).'|'.$this->blockvars['template']);

}


function setContent($isreturn=false){

global $jieqiTpl;

global $jieqiConfigs;

global $jieqiSort;


$articleid = $this->exevars['bookid'];

$listnum = $this->exevars['listnum'];

include_once($GLOBALS['jieqiModules']['article']['path'].'/class/article.php');

include_once( $GLOBALS['jieqiModules']['article']['path']."/class/chapter.php" );

        $chapter_handler =& jieqichapterhandler::getinstance( "JieqiChapterHandler" );

$criteria = new criteriacompo( new criteria( "articleid", $articleid ) );

$criteria->setsort( "chapterorder" );

$criteria->setorder( "DESC" );

$criteria->setlimit( $listnum );

$chapter_handler->queryobjects( $criteria );

$i = 0;

$chapterrows = array( );

$k = 0;

while ( $chapter = $chapter_handler->getobject( ) )

{

$chapterrows[$k]['articleid'] = $chapter->getvar( "articleid" );

$chapterrows[$k]['chapterid'] = $chapter->getvar( "chapterid" );

$chapterrows[$k]['chaptertype'] = $chapter->getvar( "chaptertype" );

$chapterrows[$k]['lastupdate'] = $chapter->getvar( "lastupdate" );

$chapterrows[$k]['chaptername'] = $chapter->getvar( "chaptername" );

$chapterrows[$k]['chapterorder'] = $chapter->getvar( "chapterorder" );

$chapterrows[$k]['url_chapterread'] = "/reader.php?aid=".$chapter->getvar( "articleid" )."&cid=".$chapter->getvar( "chapterid" );

++$k;

}

$jieqiTpl->assign_by_ref( "chapterrows", $chapterrows );


}

}


?>




上面的代码是区块代码,用以杰奇在首页调用指定文章的指定最新章节数,喜欢的可以拿去用。

JIEQI首页(或任意位置)调用指定小说的章节列表

全文详见:http://it-club.cn/post/43.html

TOP

评论列表


发表评论
来宾的头像

TOP

网站分类

TOP

站点信息

  • 文章总数:737
  • 页面总数:1
  • 分类总数:3
  • 标签总数:24
  • 评论总数:270
  • 浏览总数:9921333