I will not introduce the dedecms which has a dede: tag. We can use it directly.
Call the tags tag of the current article and perform a secondary development.
The code is as follows: |
Copy code |
If (! Function_exists ('gettags ')){ Function GetTags ($ aid) { Global $ dsql; $ Tags = "; $ Query = "SELECT tag FROM '##__ taglist' WHERE aid = '$ aid'"; $ Dsql-> Execute ('tag', $ query ); While ($ row = $ dsql-> GetArray ('tag ')) { $ Tags. = ($ tags = "? $ Row ['tag']: ','. $ row ['tag']); } Return $ tags; } } Replace with: // 111cn.net If (! Function_exists (")){ Function GetTags ($ aid ){ Global $ dsql; $ Tags = "; $ Query = "SELECT tag FROM '##__ taglist' WHERE aid = '$ aid'"; $ Dsql-> Execute ('tag', $ query ); While ($ row = $ dsql-> GetArray ('tag ')) { $ Tags. = ($ tags = "? "<A href =/tags. php? /{$ Row ['tag']} target = _ blank >{$ row ['tag']} </a> www.111cn.net ":','. "<a href =/tags. php? /{$ Row ['tag']} target = _ blank >{$ row ['tag']} </a> "); } Return $ tags; } } |
Call the tags tab on the open table page to find a reference
Add the following code as needed on the list template page
The code is as follows: |
Copy code |
[Field: id runphp = yes] $ Tsql = new DedeSql (false ); $ Tags = ""; $ Tsql-> SetQuery ("Select I. tagname From dede_tag_list t left join dede_tag_index I on I. id = t. tid where t. aid = '@ me '"); $ Tsql-> Execute ('t '); While ($ row = $ tsql-> GetArray ('t', MYSQL_ASSOC )){ $ Tags. = "<a href = '/tag. php? /". Urlencode ($ row ['tagname']). "'> ". $ row ['tagname']. "</a>" ;}@ me = $ tags; [/Field: id] |
Please note that the relevant table names are correct. If you have modified the relevant table names, you must modify them here.
Or write it directly in include/common. func. php for processing.
Step 1: Open the root directory of the website program and find the file: include/common. func. php.
Add the following code at the bottom:
The code is as follows: |
Copy code |
Function listtag ($ aid ){ $ Tsql = new DedeSql (false ); $ Tags = "; $ Tsql-> SetQuery ("Select I. tag From dede_taglist t left join dede_tagindex I on I. id = t. tid where t. aid = '$ aid '"); $ Tsql-> Execute ('t '); While ($ row = $ tsql-> GetArray ('t', MYSQL_ASSOC )){ $ Tags. = "<a href = '/tags. php? /". Urlencode ($ row [" "tag" "])."/'> ". $ row [" "tag" "]." </a> ";} Return $ tags; } |
Step 2: use the tag {dede: field. id function = "listtag (@ me)"/} to call the TAG. On the list page, you can use [field: id function = "listtag (@ me) "/] to call the TAG of the article page.
Step 3: The dede list page is now successfully resolved to call the article tag.