当前位置:网站首页>DEDECMS织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间
DEDECMS织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间
2022-07-15 13:59:00 【用户9841292】
在不影响程序原来功能的基础下,二次开发让上一篇下一篇标签自由可控地输出链接、标题、缩略图、时间,没有上一篇或者下一篇时不输出任何东西
实现教程
打开 /include/arc.archives.class.php 找到 大概在 735 行左右的
else if($ctag->GetName()=='fieldlist')制在它的 上面 加入
else if($ctag->GetName()=='prenextdiy')
{
$innertext = trim($ctag->GetInnerText());
if($innertext)
{
$get = $ctag->GetAtt('get');
$diys['diy'] = $this->GetPreNext('diy');
$revalue = '';
$dtp2 = new DedeTagParse();
$dtp2->SetNameSpace('field','[',']');
$dtp2->LoadSource($innertext);
foreach($diys as $row)
{
foreach($dtp2->CTags as $tid=>$ctag2)
{
if(isset($row[$get][$ctag2->GetName()]))
{
$dtp2->Assign($tid,$row[$get][$ctag2->GetName()]);
}
}
$revalue .= $dtp2->GetResult();
}
if($row[$get]['id']) $this->dtp->Assign($i,$revalue);
}
}复制如图
继续找到,大概在852行左右的
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";在它的 上面 加入
$preRow['litpic'] = (empty($preRow['litpic'])) ? $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif' : $preRow['litpic'];
$this->PreNext['diy']['pre']['id'] = $preRow['id'];
$this->PreNext['diy']['pre']['arcurl'] = $mlink;
$this->PreNext['diy']['pre']['title'] = $preRow['title'];
$this->PreNext['diy']['pre']['litpic'] = $preRow['litpic'];
$this->PreNext['diy']['pre']['pubdate'] = $preRow['senddate'];如图
继续找到,大概在875行左右的
$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";在它的 上面 加入
$nextRow['litpic'] = (empty($nextRow['litpic'])) ? $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif' : $nextRow['litpic'];
$this->PreNext['diy']['next']['id'] = $nextRow['id'];
$this->PreNext['diy']['next']['arcurl'] = $mlink;
$this->PreNext['diy']['next']['title'] = $nextRow['title'];
$this->PreNext['diy']['next']['litpic'] = $nextRow['litpic'];
$this->PreNext['diy']['next']['pubdate'] = $nextRow['senddate'];如图
继续找到,大概在 889 行左右的
if($gtype=='pre')在它的 上面 加入
if($gtype=='diy')
{
return $this->PreNext['diy'];
}如图
内容页模板里上一篇下一篇调用标签写法
上一篇
{dede:prenextdiy get='pre'}
<li>
<a href="[field:arcurl/]"><img src="[field:litpic/]" width="50" height="50"></a>
<p><a href="[field:arcurl/]">[field:title/]</a><span>时间:[field:pubdate function="MyDate('Y-m-d',@me)"/]</span></p>
</li>
{/dede:prenextdiy}
下一篇
{dede:prenextdiy get='next'}
<li>
<a href="[field:arcurl/]"><img src="[field:litpic/]" width="50" height="50"></a>
<p><a href="[field:arcurl/]">[field:title/]</a><span>时间:[field:pubdate function="MyDate('Y-m-d',@me)"/]</span></p>
</li>
{/dede:prenextdiy} 注意:标签是自定义的 dede:prenextdiy
边栏推荐
- Technology sharing | common interface protocol analysis
- 【OpenFOAM學前預備3——安裝OpenFOAM-v8】
- 2022-07-15日报:Meta宣布推出Make-A-Scene:可基于文字和草图控制AI图像生成
- tinymce5.0.8编辑器最新版本中文版
- Upload pictures / files
- How to test SQL of Flink? You can't use jar test every time, so sqk client comes
- MySQL8.0学习记录18 - Tablespaces
- [openfoam Pre - school Preparation 3 - install openfoam - V8]
- 现在网上开户安全么?想知道股票开账户如何优惠开户?
- 工业交换机的价格为什么有高低之分?
猜你喜欢
随机推荐
js图片裁剪及压缩整合插件
Fade the background registration + login form page
Tab plus swiper long list scrolling
2022第二届网刃杯网络安全大赛-Web
Probe into parental delegation mechanism from source code
MGRE and OSPF
JS image editor plug-in filerobot
25 most popular original technical articles of ink sky wheel from January to June 2022
SaaS application: the best way to realize enterprise digital transformation
【OpenFOAM學前預備3——安裝OpenFOAM-v8】
The practice of opengauss database on CentOS, configuration
DAY_4作业——判断数组内是否有某一个数据————实现数组映射(放大 10 倍)—— 实现按序插入数组(修改bug)——实现数组去重
JVM内存模型——运行时数据区的特点和作用
Pythia:Facebook最新开源的视觉、语言多任务学习框架
Leetcode-31-next spread
Good news | the scores of candidates in this area can be queried
如何使用Fiddler进行弱网测试
技术分享 | 使用postman发送请求
LM-Nav:基于语言、视觉和行为大模型的机器人导航方法
现在网上开户安全么?想知道股票开账户如何优惠开户?






![[go to the heart of go]](/img/4a/0c287557da803200efe580611e1e8d.png)


