This article mainly introduces the weaving dream dedecms to obtain the next article link of the method, this article explains the way to get the next article in PHP's link, the need for friends can refer to the next
We know that in the article page call before and after the link and title of the article, dedecms default on the previous and next article of the label is {dede:prenext get= ' pre '/} {dede:prenext get= ' next '/}. Sometimes we just need links instead of headings, and how do we do that? We should be able to think of a regular, right? That's right! The final implementation code is given below.
Dedecms template Download Address: www.php.cn/xiazai/code/dedecms
Previous Address
The code is as follows:
{dede:prenext get= ' pro ' runphp= "yes"}preg_match_all ('/(. +?) <\/a.*?>/sim ', @me, $strResult, preg_pattern_order); @me = $strResult [1][0]; {/dede:prenext}
Next Address
The code is as follows:
{dede:prenext get= ' next ' runphp= "yes"}preg_match_all ('/(. +?) <\/a.*?>/sim ', @me, $strResult, preg_pattern_order); @me = $strResult [1][0]; {/dede:prenext}
Extension: How to modify the word count of the upper and lower articles
Edit Open include/arc.archives.class.php file
Find: $this->prenext[' pre '] = "previous: {$preRow [' title ']}";
Add the following code to this line $prerow[' title ']=cn_substr ($preRow [' title '],30);//display up to 15 characters
Find: $this->prenext[' next '] = "Next: { $nextRow [' title ']} ";
Add the following code to this line $nextrow[' title ']=cn_substr ($nextRow [' title '],30);//display up to 15 kanji
and then regenerate all pages.