Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of adding an article abstract at the link between the previous article and the next article on the article page in DedeCMS

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to add a summary of the article to the next link on the page of the article in DedeCMS. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

How to add an article summary to the next link to the previous article on the article page in DedeCMS?

The DedeCMS system defaults to displaying only the title in the link to the previous and next article, but sometimes we want to display other information, such as a summary of the article. Next, I would like to introduce you to the method.

Recommended study: dream weaving cms

The DedeCMS system defaults to displaying only the title in the link to the previous and next article, but sometimes we want to display other information, such as a summary of the article.

Find the arc.archives.class.php file, under the include directory, and then look for the function "GetPreNext" to set the

$query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, t.typedirret.typenameret.nameruleret.namerule2ret.ispartret.moresiteret.siteurl.sitepath from `jcode_ archives` arc left join jcode_arctype t on arc.typeid=t.id"

Change it to:

$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"

By comparison, there is only more arc.description now, which is the abstract of the article, also known as the article description.

It is important to note that the jcode_ in jcode_archives and jcode_arctype here is the prefix of my table structure. You need to change this prefix to your own.

Now we have extracted the description of the article from the database. The next step is to display the description on the page, and the code that displays the link text is originally like this, which you can find by looking for it, but it is actually near the above code:

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'] = "previous post: {$preRow ['title']}" $this- > PreNext ['preimg'] = "

{$preRow['title']}

";} else {$this- > PreNext ['pre'] =" previous article: no "; $this- > PreNext [' preimg'] ="

对不起,没有上一图集了!

If (is_array ($nextRow)) {$mlink = GetFileUrl ($nextRow ['id'], $nextRow [' typeid'], $nextRow ['senddate'], $nextRow [' title'], $nextRow ['ismake'], $nextRow [' arcrank'], $nextRow ['namerule'], $nextRow [' typedir'], $nextRow ['money'], $nextRow [' filename'], $nextRow ['moresite'], $nextRow [' siteurl'], $nextRow ['sitepath']) $this- > PreNext ['next'] = "next article: {$nextRow [' title']}"; $this- > PreNext ['nextimg'] = "

{$nextRow['title']}

";} else {$this- > PreNext ['next'] =" next article: no more "; $this- > PreNext [' nextimg'] ="

对不起,没有下一图集了!

";}}

Now to display the article description, add a div div containing the article description after each a tag:

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'] = "previous post: {$preRow [' title']} {$preRow ['description']}"; $this- > PreNext [' preimg'] = "

{$preRow['title']}

{$preRow ['description']} ";} else {$this- > PreNext [' pre'] =" previous article: no "; $this- > PreNext ['preimg'] ="

对不起,没有上一图集了!

If (is_array ($nextRow)) {$mlink = GetFileUrl ($nextRow ['id'], $nextRow [' typeid'], $nextRow ['senddate'], $nextRow [' title'], $nextRow ['ismake'], $nextRow [' arcrank'], $nextRow ['namerule'], $nextRow [' typedir'], $nextRow ['money'], $nextRow [' filename'], $nextRow ['moresite'], $nextRow [' siteurl'], $nextRow ['sitepath']) $this- > PreNext ['next'] = "next article: {$nextRow [' title']} {$preRow ['description']}"; $this- > PreNext [' nextimg'] = "

{$nextRow['title']}

{$preRow ['description']} ";} else {$this- > PreNext [' next'] =" next article: no more "; $this- > PreNext ['nextimg'] ="

对不起,没有下一图集了!

";}}

If you do this, you can display the summary of the article, but the format may be messy, and you can add styles as needed.

This is the way to add a summary of the article at the link to the previous article in the DedeCMS page. I hope the above content can be of some help and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report