What are the methods of calling the article TAG tag and adding a link to dream DEDECMS?
This article mainly introduces the Weaving Dream DEDECMS call article TAG tag and add the link method which has a certain reference value, friends in need can refer to. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
How does dream weaving DEDECMS call the article TAG tag and add a link?
Dream weaving DEDECMS calls the TAG tag of the article and adds a link.
1. For a list page, use the following code:
[field:id runphp='yes'] global $cfg_cmspath;$tags = GetTags (@ me); $revalue =''; $tags = explode (',', $tags); foreach ($tags as $key = > $value) {if ($value) {$revalue. ='. $value.'';}} @ me = $revalue; [/ field:id]
two。 For a content page, use the following code:
{dede:field.id runphp='yes'} global $cfg_cmspath;$tags = GetTags (@ me); $revalue =''; $tags = explode (',', $tags); foreach ($tags as $key = > $value) {if ($value) {$revalue. ='. $value.',';} @ me = $revalue; {/ dede:field.id}
Code interpretation
In fact, there are only three points of knowledge applied here:
1. Use the built-in GetTags function to get the TAG list corresponding to the document
two。 Split the obtained value into an array based on the comma (,) of the half-width symbol
3. Loop array elements, output and link their corresponding values
At the same time, for better compatibility, the program installation directory in the basic parameters of the system is also loaded with the global $cfg_cmspath; method, which is used to automatically be compatible with sites installed to subdirectories when attaching links.
Thank you for reading this article carefully. I hope the editor can share the article TAG tag of Weaving Dream DEDECMS and add the link method which is helpful to everyone. At the same time, I also hope that you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!