Dedecms method to replace keywords: 1. Find the "include/arc.archives.class.php" file; 2. Find "function _highlight($string, $words, $result, $) in the file pre) {...}" code, and then add "uasort($words,create_function('$a, $b'...)" after the code.
The operating environment of this tutorial: Windows 10 system, DedeCMS version 5.7, Dell G3 computer.
How to replace keywords in dedecms?
DedeCMS Website keyword batch replacement
There will be many keywords in the DedeCMS Dreamweaver template, but the length of the keywords is different, so when replacing, you must replace the short ones first, and then replace the long ones, so Only then can it be completely replaced.
Find the file include/arc.archives.class.php, at line 1226, that is:
function _highlight($string, $words, $result, $pre) { global $cfg_replace_num; $string = str_replace('"', '"', $string);
Add a piece of code at the end:
function _highlight($string, $words, $result, $pre) { global $cfg_replace_num; $string = str_replace('"', '"', $string); uasort($words,create_function('$a, $b','return strlen($a)>strlen($b);'));
Related introduction:
Dreamweaver Content Management System (DedeCms) is famous for its simplicity, practicality, and open source, and is the most well-known PHP in China The open source website management system is also the PHP CMS system with the most users. After years of development, the version has made great progress in terms of functionality and ease of use. The main target users of the free version of DedeCms are targeted In personal webmasters, the function is more focused on the construction of personal websites or small and medium-sized portals. Of course, there are also corporate users and schools using this system.
In August 2004, Lin Xue wrote DedeCMS, which is still there today Used by hundreds of thousands of enterprises and individual webmasters.
Recommended learning: dedecms tutorial
The above is the detailed content of How to replace keywords in dedecms. For more information, please follow other related articles on the PHP Chinese website!