. ..;" and save."/> . ..;" and save.">

Home >CMS Tutorial >DEDECMS >How to solve the automatic linking of document keywords in dedecms V5.6

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

藏色散人
藏色散人Original
2019-12-16 09:43:042330browse

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++; 
} 
}

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>"; 
}

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!

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