>  기사  >  php教程  >  phpcms2008:phpcms2008添加上一篇下一篇的功能

phpcms2008:phpcms2008添加上一篇下一篇的功能

WBOY
WBOY원래의
2016-06-21 08:51:341059검색

第一步:修改show.php
在代码
if(!$C['defaultchargepoint'] && !$r['readpoint'])
前面增加代码
//
//上一篇文章
$more_pre = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`if(empty($more_pre)) {
$more_pre['title']='没有了';
$more_pre['url']='';
}
//下一篇文章
$more_next = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`>$contentid and `catid`='{$r['catid']}' order by contentid asc limit 0,1");
if(empty($more_next)) {
$more_next['title']='没有了';
$more_next['url']='';
}
//
添加代码>
第二步:修改include/html.class.php中的show函数
在代码
if(strpos($content, '[page]') !== false)
前增加代码:
//
global $db;
//上一篇文章
$more_pre = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`if(empty($more_pre)) {
$more_pre['title']='没有了';
$more_pre['url']='';
}
//下一篇文章
$more_next = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`>$contentid and `catid`='$catid' order by contentid asc limit 0,1");
if(empty($more_next)) {
$more_next['title']='没有了';
$more_next['url']='';
}
//
添加代码>
第三步:在模板目录/phpcms/show.html文件中您认为合适的位置添加

第四步:在您的CSS样式文件中添加
/***上一篇下一篇文章链接(fke.la)***/
.moreArticle{
margin:5px 0px;width:100%;
font-size:12px;clear:both; 本文链接http://www.cxybl.com/html/wlbc/Php/20120627/31129.html



성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.