discuz門戶diy實(shí)現(xiàn)翻頁(yè)功能的方法
1、打開 sourceclassblockportalblock_article.php 文件
找到
function getdata($style, $parameter)
修改為
function getdata($style, $parameter, $bid)
找到
$query = DB::query("SELECT at.*, ac.viewnum, ac.commentnum FROM ".DB::table('portal_article_title')." at LEFT JOIN ".DB::table('portal_article_count')." ac ON at.aid=ac.aid WHERE $wheresql$keyword ORDER BY $orderby LIMIT $startrow, $items");
在其上方加入:
//首頁(yè)翻頁(yè)修改
if($bid==53){
$page = $_REQUEST['page']?$_REQUEST['page']:1;
$startrow = ($page-1)*$items;
}
這里的bid為diy的記錄id,查看方法可以通過(guò)firebug工具查看。此文中后面用到的bid均為此含義。
2、打開 sourcefunctionfunction_block.php 文件
找到
if($forceupdate) {
block_updatecache($bid, true);
$block = $_G['block'][$bid];
}
在其上方加入:
//如果是首頁(yè)最新文章,去掉緩存
if ($bid == 53) {
$forceupdate = 1;
}
找到
$return = $obj->getdata($thestyle, $block['param']);
修改為
$return = $obj->getdata($thestyle, $block['param'],$bid);
3、打開 sourcefunctionfunction_core.php 文件
找到 function block_display($bid) 方法
在其方法內(nèi)的尾部加入:
//翻頁(yè)更改
if($bid==53){
$page = $_REQUEST['page']?$_REQUEST['page']:1;
$html = "";
$html .= '
echo $html;
}
至此,修改完成。
找到
function getdata($style, $parameter)
修改為
function getdata($style, $parameter, $bid)
找到
$query = DB::query("SELECT at.*, ac.viewnum, ac.commentnum FROM ".DB::table('portal_article_title')." at LEFT JOIN ".DB::table('portal_article_count')." ac ON at.aid=ac.aid WHERE $wheresql$keyword ORDER BY $orderby LIMIT $startrow, $items");
在其上方加入:
//首頁(yè)翻頁(yè)修改
if($bid==53){
$page = $_REQUEST['page']?$_REQUEST['page']:1;
$startrow = ($page-1)*$items;
}
這里的bid為diy的記錄id,查看方法可以通過(guò)firebug工具查看。此文中后面用到的bid均為此含義。
2、打開 sourcefunctionfunction_block.php 文件
找到
if($forceupdate) {
block_updatecache($bid, true);
$block = $_G['block'][$bid];
}
在其上方加入:
//如果是首頁(yè)最新文章,去掉緩存
if ($bid == 53) {
$forceupdate = 1;
}
找到
$return = $obj->getdata($thestyle, $block['param']);
修改為
$return = $obj->getdata($thestyle, $block['param'],$bid);
3、打開 sourcefunctionfunction_core.php 文件
找到 function block_display($bid) 方法
在其方法內(nèi)的尾部加入:
//翻頁(yè)更改
if($bid==53){
$page = $_REQUEST['page']?$_REQUEST['page']:1;
$html = "";
$html .= '
";
echo $html;
}
至此,修改完成。