Home > Article > CMS Tutorial > How to call tag label and bring link in dedecms system list page
dedecms system list page how to call the tag tag and bring the link?
The DedeCMS system list page calls the TAG tag and brings the link. I think many webmaster friends want to achieve it. Next, I will introduce the implementation method and code explanation in detail. If you are interested, you can Don’t miss it, I hope it can help you
Recommended learning: 梦Weavercms
Implementation method
Here is the default template as an example, open /templets/default/list_article.htm Found:
The code is as follows:
<small>好评:</small>[field:scores/]
Add the following code after it:
The code is as follows:
<small>标签:</small> [field:id runphp='yes'] global $cfg_cmspath; $tags = GetTags(@me); $revalue = ''; $tags = explode(',', $tags); foreach($tags as $key => $value){ if($value){ $revalue .= '<a href="'.$cfg_cmspath.'/tags.php?/'.$value.'/">'.$value.'</a> '; } } @me = $revalue; [/field:id]
Save Then.
Note: Here I am taking the default template as an example. It is correct to open your own template and add code in the appropriate location.
Code explanation
In fact, only three knowledge points are used here:
1. Use the built-in GetTags function to obtain the TAG list corresponding to the document;
2. Split the obtained value into an array using the half-width comma (,) as the standard;
3. Loop the array elements, output the corresponding value and add a link;
At the same time, for better compatibility, the global $cfg_cmspath; method is also used here to load the program installation directory in the basic system parameters, which is used to automatically install compatible files to the subsystem when additional links
directory site.
Okay, this is the content, and this is the explanation. I hope those who understand can get inspiration from it and draw inferences from one example. Looking forward to sharing your tutorials too. For those who don't understand it, it doesn't matter. You can save this code and learn about it later.
The above is the detailed content of How to call tag label and bring link in dedecms system list page. For more information, please follow other related articles on the PHP Chinese website!