Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of intercepting the title length of DEDECMS articles

Shulou Source: shulou.com Published: 2022-06-02 04:43:08 10月03日 Update

How to intercept the title length of DEDECMS articles? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

How to intercept the title length of DEDECMS article?

Friends who know about dedecms must also be very familiar with how to get the tags of the previous and next articles. Dedecms gets the tags of the previous and next articles as: {dede:prenext get='pre'/} and {dede:prenext get='next'}, respectively.

In this tag, there is no function of setting the number of words in the title of the previous article or the next article, so how can we achieve this function? In fact, the dedecms system has also done a very good job, and it is also very thoughtful, which can be set up.

Dedecms sets the number of words in the title of the previous article and the next article:

Step 1: find the "include/arc.archives.class.php" file under dedecms and open it with DW or notepad.

Step 2: find $this- > PreNext ['pre'] = "previous post: {$preRow [' title']}"; add $preRow ['title'] = cn_substr ($preRow [' title'], 30) to this line; 30 means 30 bytes, or 15 Chinese characters. This can be set according to the actual situation.

Step 3: find $this- > PreNext ['next'] = "next article: {$nextRow [' title']}"; add $nextRow ['title'] = cn_substr ($nextRow [' title'], 30); to this line.

Then save it, and at this point, dedecms's method of setting the number of words in the title of the previous and next article is complete.

Thank you for reading! After reading the above, do you have a general understanding of the method of intercepting the title length of DEDECMS articles? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

Tags: Title previous article article method content length number of words label line function question thoughtful that is bytes actually that is situation meaning file Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MariaDB NVidia vpn Xiaomi