How to get the link of the next article by Zhimeng dedecms

Source: Internet
Author: User
This article describes how to get the link of the previous article by Zhimeng dedecms. This article describes how to get the link of the previous article by using PHP, for more information, see the next article. This article describes how to use dedecms to obtain the link from the previous article. This article describes how to use PHP to obtain the link from the previous article. For more information, see

We know that the link and title of the post are called on the post page. by default, dedecms labels for the previous and next posts are {dede: prenext get = 'pre'/} {dede: prenext get = 'next '/}. Sometimes, out of need, we only need a link instead of a title. what should we do? Should we be able to use regular expressions? That's right! The final implementation code is provided below.

Dedecms Template: www.php1.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: Method for modifying the number of words in the upper and lower articles

Edit and open the include/arc. archives. class. php file.
Search: $ this-> PreNext ['pre'] = "previous: {$ preRow ['title']}";
Add the following code $ preRow ['title'] = cn_substr ($ preRow ['title'], 30) to this line. // A maximum of 15 Chinese characters can be displayed.
Find: $ this-> PreNext ['Next'] = "next: {$ nextRow ['title']}";
Add the following code $ nextRow ['title'] = cn_substr ($ nextRow ['title'], 30) to this line. // A maximum of 15 Chinese characters can be displayed.
Then generate all the pages again.

The above is the detailed content of the method used by Zhimeng dedecms to obtain the link of the next article. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.