dede3.1上一篇下一篇分开调用_DedeCms教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
功能:
1.文章内容页面上一篇、下一篇分两个标签调用,模板制作更方便!
2.调用的上一篇、下一篇文章改为本文章所在栏目,而不是现在的全站。
调用例子:
<div style="text-align: left">↑{dede:preurl/}</div>
<div style="text-align: left">↓{dede:nexturl/}</div>
改法:打开includeinc_archives_view.php
找到 //--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext()
{
$rs = "";
$aid = $this->ArcID;
$next = " dede_archives.ID>'$aid' order by dede_archives.ID asc ";
$pre = " dede_archives.ID<'$aid' order by dede_archives.ID desc ";
$query = "Select dede_archives.ID,dede_archives.title,
dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,
dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,
dede_arctype.moresite,dede_arctype.siteurl
from dede_archives left join dede_arctype on dede_archives.typeid=dede_arctype.ID
where ";
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow)){
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);
$rs .= "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
}
else{
$rs .= "上一篇:没有了 ";
}
if(is_array($nextRow)){
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);
$rs .= " 下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
}
else{
$rs .= " 下一篇:没有了 ";
}
return $rs;
}
改为:
//--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext($pn=1)
{
$rs = "";
$aid = $this->ArcID;
$typeid = $this->Fields['typeid'];
$next = " dede_archives.ID>'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID asc ";
$pre = " dede_archives.ID<'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID desc ";
$query = "Select dede_archives.ID,dede_archives.title,
dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,
dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,
1.文章内容页面上一篇、下一篇分两个标签调用,模板制作更方便!
2.调用的上一篇、下一篇文章改为本文章所在栏目,而不是现在的全站。
调用例子:
<div style="text-align: left">↑{dede:preurl/}</div>
<div style="text-align: left">↓{dede:nexturl/}</div>
改法:打开includeinc_archives_view.php
找到 //--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext()
{
$rs = "";
$aid = $this->ArcID;
$next = " dede_archives.ID>'$aid' order by dede_archives.ID asc ";
$pre = " dede_archives.ID<'$aid' order by dede_archives.ID desc ";
$query = "Select dede_archives.ID,dede_archives.title,
dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,
dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,
dede_arctype.moresite,dede_arctype.siteurl
from dede_archives left join dede_arctype on dede_archives.typeid=dede_arctype.ID
where ";
$nextRow = $this->dsql->GetOne($query.$next);
$preRow = $this->dsql->GetOne($query.$pre);
if(is_array($preRow)){
$mlink = GetFileUrl($preRow['ID'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],$preRow['namerule'],$preRow['typedir'],$preRow['money'],true,$preRow['siteurl']);
$rs .= "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
}
else{
$rs .= "上一篇:没有了 ";
}
if(is_array($nextRow)){
$mlink = GetFileUrl($nextRow['ID'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'],$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],true,$nextRow['siteurl']);
$rs .= " 下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
}
else{
$rs .= " 下一篇:没有了 ";
}
return $rs;
}
改为:
//--------------------------
//获取上一篇,下一篇链接
//--------------------------
function GetPreNext($pn=1)
{
$rs = "";
$aid = $this->ArcID;
$typeid = $this->Fields['typeid'];
$next = " dede_archives.ID>'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID asc ";
$pre = " dede_archives.ID<'$aid' and dede_archives.typeid='$typeid' order by dede_archives.ID desc ";
$query = "Select dede_archives.ID,dede_archives.title,
dede_archives.typeid,dede_archives.ismake,dede_archives.senddate,dede_archives.arcrank,dede_archives.money,
dede_arctype.typedir,dede_arctype.typename,dede_arctype.namerule,dede_arctype.namerule2,dede_arctype.ispart,
相关DedeCms教程:
- Dedecms生成百度地图图文教程
- 织梦dedecms生成下拉式友情链接列表
- DEDECMS使用拼音首字母做栏目名称
- 织梦DEDECMS站群增强版 DedeCMS搭建站群首选
- DedeCMS Error:Tag disabled:php错误的完整处理方法
- dedecms编码转换方法 gbk转UTF-8,UTF-8转GBK
- 防XSS,sql注射,代码执行,文件包含的通用代码
- DedeCms教程:优化DedeCMS搜索结果
- DedeCms教程:Linux+Apache+PHP+MySQL服务器环境(CentOS篇)
- DedeCms教程:LuManager服务器管理软件安装DEDECMS软件
- DedeCms教程:Ubuntu/Debian上安装 PHP 5.3, Nginx 和 PHP-fpm
- DedeCms教程:windows server 2003 php 环境搭建