Home > Article > CMS Tutorial > What should I do if TAG is lost due to upgrading dedecms5.1 to 5.3?
dedecms5.1 is upgraded to 5.3 and what should I do if the TAG is lost?
dedecms5.1 is upgraded to 5.3 Dealing with issues such as TAG loss
It is now possible to display TAGs on article pages with links normally, and the TAGs of articles before the upgrade have been restored. Here are the specific solutions. The main thing is that the last sql sentence can be executed as follows.
Recommended study: 梦Weavercms
In fact, many people have already answered the answer to the TAG problem on the forum. Maybe everyone has not tried it seriously. It's not that the code provided by others is wrong
, but that you can't completely COPY their code. Many codes need to modify the data table prefix before they can be used.
The following is my method to solve the TAG problem:
First, call the TAG code of the current article on the article page:
Use Tag directly: {dede:field.tags /} Replace the original code
For example, my website used to obtain the TAG code of the current article like this. Note that the red part is the code, and the black part is whatever you want:
Tag:{dede:tag type= 'current'/}
So the original code to display the TAG place now is:
Tag: {dede:field.tags/}
The above is the first one, Next, we need to modify the related files of DEDE CMS. Open the file \include\common.func.php
Find //Get all tags of a document and put the following codes
The code is as follows:
function GetTags($aid) { global $dsql; $tags = ''; $query = "Select tag From [url=mailto:`ddmx_taglist]`ddmx_taglist[/url]` where aid='$aid' "; $dsql->Execute('tag',$query); while($row = $dsql->GetArray('tag')) { $tags .= ($tags=='' ? $row['tag'] : ','.$row['tag']); } return $tags; } function ParamError() { ShowMsg('对不起,你输入的参数有误!','javascript:;'); exit(); }
is replaced by the following codes. During this period, you should modify your table prefix according to your actual situation.
Pay attention to the 'dede_dedecmstaglist' below and modify it according to your own table prefix.
The code is as follows:
function GetTags($aid) { global $dsql; $tags = ''; $query = "Select tag From `dede_dedecmstaglist` 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>" : ','."<a href=/tags.php?/{$row['tag']} target=_blank>{$row['tag']}</a>"); } return $tags; } function ParamError() { ShowMsg('对不起,你输入的参数有误!','javascript:;'); exit(); }
OK, now as long as the TAG of your article is not lost, you can call the linked article TAG on the article page after completing the above steps.
If your TAG is lost during the upgrade process, then perform the following steps.
Enter your website management background
Select "System"----------"SQL Command Line Tool"
Run SQL command:
The code is as follows:
UPDATE dede_tagindex,dede_taglist SET dede_taglist.tag = dede_tagindex.tag WHERE dede_taglist.tid=dede_tagindex.id;
Be careful not to COPY the above code completely, and modify the table prefix according to your actual situation.
The above is the detailed content of What should I do if TAG is lost due to upgrading dedecms5.1 to 5.3?. For more information, please follow other related articles on the PHP Chinese website!