First step: Locate the file: \source\class\block\portal\block_article.php
Find this method: function GetData ($style, $parameter)
Modify it to: function GetData ($style, $parameter, $bid)
In this document, we can find the following words:
$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 the $keyword ORDER by $orderby LIMIT $startrow, $items ");
On top of it, add:
Page page Changes
if ($bid ==53) {
$page = $_request[' page ']?$_request[' page ']:1;
$startrow = ($page-1) * $ITEMS;
}
Here the bid is a DIY record ID and the viewing method can be viewed through the Firebug tool. The bid used later in this article is meant for this purpose.
Part Two, find the file \source\function\function_block.php
To locate here:
if ($forceupdate) {
Block_updatecache ($bid, true);
$block = $_g[' block ' [$bid];
}
On top of it, add:
If it's the most recent article on the homepage, remove the cache
if ($bid = = 53) {
$forceupdate = 1;
}
In this document, look for such a sentence:
$return = $obj->getdata ($thestyle, $block [' param ']);
Modify it to:
$return = $obj->getdata ($thestyle, $block [' param '], $bid);
Step three, locate the file: \source\function\function_core.php
Navigate to this method: function Block_display ($bid)
At the end of its method, add:
Page changes
if ($bid ==53) {
$page = $_request[' page ']?$_request[' page ']:1;
$html = "<style>"
. ". page{padding:10px; Float:left;} "
. ". Page li{float:left; line-height:20px; padding:8px; font-size:16px;} "
. ". Page li. On{color: #f57500; font-weight:800;} "
. "</style>";
$html. = ' <div class= ' page ><ul> ';
if ($page <11) {
for ($i =1; $i <21; $i + +) {
if ($page = = $i) {
$html. = ' <li><a href= '/?page= '. $i. ' class= ' on ' > ' $i. ' </a></li> ';
}else{
$html. = ' <li><a href= '/?page= '. $i. ' > '. $i. ' </a></li> ';
}
}
}else{
for ($i = $page-9; $i < $page; $i + +) {
$html. = ' <li><a href= '/?page= '. $i. ' > '. $i. ' </a></li> ';
}
$html. = ' <li><a href= '/?page= '. $page. ' class= ' on ' > '. $page. ' </a></li> ';
for ($i = $page +1; $i < $page +10; $i + +) {
$html. = ' <li><a href= '/?page= '. $i. ' > '. $i. ' </a></li> ';
}
}
$html. = "</ul></div>";
Echo $html;
}
At this point, the modification completed, the case please view: www.php2.cc
This article is from the "PHP Two Development" blog, please be sure to keep this source http://php2cc.blog.51cto.com/6143082/1684277
Discuz Portal DIY to realize the change of paging function record