Home  >  Article  >  CMS Tutorial  >  What should I do if TAG is lost due to upgrading dedecms5.1 to 5.3?

What should I do if TAG is lost due to upgrading dedecms5.1 to 5.3?

藏色散人
藏色散人Original
2019-12-24 10:10:222511browse

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==&#39;&#39; ? "<a href=/tags.php?/{$row[&#39;tag&#39;]} target=_blank>{$row[&#39;tag&#39;]}</a>" : &#39;,&#39;."<a href=/tags.php?/{$row[&#39;tag&#39;]} target=_blank>{$row[&#39;tag&#39;]}</a>"); 
} 
return $tags; 
} 
function ParamError() 
{ 
ShowMsg(&#39;对不起,你输入的参数有误!&#39;,&#39;javascript:;&#39;); 
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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn