Home > CMS Tutorial > DEDECMS > body text

How to solve the automatic linking of document keywords in dedecms V5.6

藏色散人
Release: 2019-12-16 09:43:04
Original
2277 people have browsed it

How to solve the automatic linking of document keywords in dedecms V5.6

dedecms V5.6 How to solve the automatic linking of document keywords?

Requires the following settings:

1. Backend-Collection-Document Keyword Maintenance Add Keywords and Links

2. Backend-System-Core Settings Keywords Replacement (yes/no) Using this function will affect the speed of HTML generation: Yes

3. Backend-System-Other Options Document Content The number of times to replace the same keyword (0 means all replacements): Set a value (by the way) By the way, for example, if an article contains keywords that include each other, such as dede and dedecms, the system will replace the subsequent dedecms with dede. My approach is to set the number of keyword replacements to 1, and then maintain the document keywords there. Set the frequency of dede and dedecms to be the same and you’re done.)

Modify the file:/include/arc.archives.class.php

Modification method:

Find the code:

The code is as follows:

foreach($kws as $k) 
{ 
$k = trim($k); 
if($k!=''") 
{ 
if($i > $maxkey) 
{ 
break; 
} 
$myrow = $this->dsql->GetOne("select * from dede_keywords where keyword=&#39;$k&#39; And rpurl<>&#39;&#39; "); 
if(is_array($myrow)) 
{ 
$karr[] = $k; 
$GLOBALS[&#39;replaced&#39;][$k] = 0; 
$kaarr[] = "<a href=&#39;{$myrow[&#39;rpurl&#39;]}&#39;><u>$k</u></a>"; 
} 
$i++; 
} 
}
Copy after login

Replace the above code with the following code:

The code is as follows:

global $dsql; 
$query="SELECT * FROM dede_keywords WHERE rpurl<>&#39;&#39; ORDER BY rank DESC"; 
$dsql->SetQuery($query); 
$dsql->Execute(); 
while($row = $dsql->GetArray()) 
{ 
$key = trim($row[&#39;keyword&#39;]); 
$key_url=trim($row[&#39;rpurl&#39;]); 
$karr[] = $key; 
$kaarr[] = "<a href=&#39;$key_url&#39; target=&#39;_blank&#39;><u>$key</u></a>"; 
}
Copy after login

Recommended learning: Dreamweavercms

The above is the detailed content of How to solve the automatic linking of document keywords in dedecms V5.6. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template