搜索
首页CMS教程DEDECMS在DedeCMS中的文章页面的上一篇下一篇链接处怎么增加文章摘要

在DedeCMS中的文章页面的上一篇下一篇链接处怎么增加文章摘要

在DedeCMS中的文章页面的上一篇下一篇链接处怎么增加文章摘要?

DedeCMS系统默认的是在文章的上一篇和下一篇的链接只显示标题,但是有时我们希望显示其他信息,比如文章的摘要。下面给大家介绍一下方法

  推荐学习:织梦cms

  DedeCMS系统默认的是在文章的上一篇和下一篇的链接只显示标题,但是有时我们希望显示其他信息,比如文章的摘要。

找到arc.archives.class.php文件,在include目录下面,然后查找“GetPreNext”这个函数,将

$query 
= "Select 
arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, 
t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath 
from `jcode_archives` arc left join jcode_arctype t on arc.typeid=t.id ";

  改成:

$query = "Select 
arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, 
arc.description,t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath 
from `jcode_archives` arc left join jcode_arctype t on arc.typeid=t.id ";

  比较一下其实现在只是多了arc.description,这就是文章的摘要,也称为文章描述。

  需要注意的是这里的jcode_archives和jcode_arctype中的jcode_是我表结构的前缀,你需要将这个前缀改成你自己的。

  现在我们已经将文章描述从数据库里面取出来了。下一步将描述显示在页面上,显示连接文字的代码本来是这样的,你可以通过查找找到,其实就在上面那段代码的附近:

if(is_array($preRow))
{
$mlink = 
GetFileUrl($preRow['id'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'],
$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);
$this->PreNext['pre'] 
= "上一篇:<a href=&#39;$mlink&#39;>{$preRow[&#39;title&#39;]}</a> 
";
$this->PreNext[&#39;preimg&#39;] = "<a href=&#39;$mlink&#39;><img 
src="{$preRow[&#39;litpic&#39;]}" alt="{$preRow[&#39;title&#39;]}"/></a> 
";
}
else
{
$this->PreNext[&#39;pre&#39;] = "上一篇:没有了 "; 
$this->PreNext[&#39;preimg&#39;] 
="<img src="/templets/default/images/nophoto.jpg" 
alt="对不起,没有上一图集了!"/>";
}
if(is_array($nextRow))
{
$mlink = 
GetFileUrl($nextRow[&#39;id&#39;],$nextRow[&#39;typeid&#39;],$nextRow[&#39;senddate&#39;],$nextRow[&#39;title&#39;],$nextRow[&#39;ismake&#39;],$nextRow[&#39;arcrank&#39;],
$nextRow[&#39;namerule&#39;],$nextRow[&#39;typedir&#39;],$nextRow[&#39;money&#39;],$nextRow[&#39;filename&#39;],$nextRow[&#39;moresite&#39;],$nextRow[&#39;siteurl&#39;],$nextRow[&#39;sitepath&#39;]);
$this->PreNext[&#39;next&#39;] 
= "下一篇:<a href=&#39;$mlink&#39;>{$nextRow[&#39;title&#39;]}</a> 
";
$this->PreNext[&#39;nextimg&#39;] = "<a href=&#39;$mlink&#39;><img 
src="{$nextRow[&#39;litpic&#39;]}" alt="{$nextRow[&#39;title&#39;]}"/></a> 
";
}
else
{
$this->PreNext[&#39;next&#39;] = "下一篇:没有了 "; 
$this->PreNext[&#39;nextimg&#39;] ="<a href=&#39;javascript:void(0)&#39; 
alt=""><img src="/templets/default/images/nophoto.jpg" 
alt="对不起,没有下一图集了!"/></a>";
}
}

  现在为了显示出文章描述,在每一个a标签之后添加一个div div中包含文章描述:

if(is_array($preRow))
{
$mlink = 
GetFileUrl($preRow[&#39;id&#39;],$preRow[&#39;typeid&#39;],$preRow[&#39;senddate&#39;],$preRow[&#39;title&#39;],$preRow[&#39;ismake&#39;],$preRow[&#39;arcrank&#39;],
$preRow[&#39;namerule&#39;],$preRow[&#39;typedir&#39;],$preRow[&#39;money&#39;],$preRow[&#39;filename&#39;],$preRow[&#39;moresite&#39;],$preRow[&#39;siteurl&#39;],$preRow[&#39;sitepath&#39;]);
$this->PreNext[&#39;pre&#39;] 
= "上一篇:<a href=&#39;$mlink&#39;>{$preRow[&#39;title&#39;]}</a> <div>{$preRow[&#39;description&#39;]}</div> 
";
$this->PreNext[&#39;preimg&#39;] = "<a href=&#39;$mlink&#39;><img 
src="{$preRow[&#39;litpic&#39;]}" alt="{$preRow[&#39;title&#39;]}"/></a> <div>{$preRow[&#39;description&#39;]}</div> "; 
}
else
{
$this->PreNext[&#39;pre&#39;] 
= "上一篇:没有了 ";
$this->PreNext[&#39;preimg&#39;] ="<img 
src="/templets/default/images/nophoto.jpg" 
alt="对不起,没有上一图集了!"/>";
}
if(is_array($nextRow))
{
$mlink = 
GetFileUrl($nextRow[&#39;id&#39;],$nextRow[&#39;typeid&#39;],$nextRow[&#39;senddate&#39;],$nextRow[&#39;title&#39;],$nextRow[&#39;ismake&#39;],$nextRow[&#39;arcrank&#39;],
$nextRow[&#39;namerule&#39;],$nextRow[&#39;typedir&#39;],$nextRow[&#39;money&#39;],$nextRow[&#39;filename&#39;],$nextRow[&#39;moresite&#39;],$nextRow[&#39;siteurl&#39;],$nextRow[&#39;sitepath&#39;]);
$this->PreNext[&#39;next&#39;] 
= "下一篇:<a href=&#39;$mlink&#39;>{$nextRow[&#39;title&#39;]}</a> <div>{$preRow[&#39;description&#39;]}</div> 
";
$this->PreNext[&#39;nextimg&#39;] = "<a href=&#39;$mlink&#39;><img 
src="{$nextRow[&#39;litpic&#39;]}" alt="{$nextRow[&#39;title&#39;]}"/></a> <div>{$preRow[&#39;description&#39;]}</div> "; 
}
else
{
$this->PreNext[&#39;next&#39;] 
= "下一篇:没有了 ";
$this->PreNext[&#39;nextimg&#39;] ="<a href=&#39;javascript:void(0)&#39; 
alt=""><img src="/templets/default/images/nophoto.jpg" 
alt="对不起,没有下一图集了!"/></a>";
}
}

  这样做的话能显示文章摘要,但是格式可能会很乱,你可以根据需要增加样式。

以上是在DedeCMS中的文章页面的上一篇下一篇链接处怎么增加文章摘要的详细内容。更多信息请关注PHP中文网其他相关文章!

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
4 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它们
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

mPDF

mPDF

mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。