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='$k' And rpurl<>'' "); if(is_array($myrow)) { $karr[] = $k; $GLOBALS['replaced'][$k] = 0; $kaarr[] = "<a href='{$myrow['rpurl']}'><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<>'' ORDER BY rank DESC"; $dsql->SetQuery($query); $dsql->Execute(); while($row = $dsql->GetArray()) { $key = trim($row['keyword']); $key_url=trim($row['rpurl']); $karr[] = $key; $kaarr[] = "<a href='$key_url' target='_blank'><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!