Hongmu Notes
Home Program Notes Empire CMS Related Search Functionality Extension (implemented using Baidu)
Program Notes Empire cms

Empire CMS Related Search Functionality Extension (implemented using Baidu)

Empire CMS Related Search Functionality Extension (implemented using Baidu)

ad1a1b7183214638

For example, retrieve a set of relevant keywords based on the title, then activate the search function – clicking on this will redirect you to the Empire CMS search page. This is possible only if the Empire CMS search functionality has been enhanced to support fuzzy search!

PHP: Retrieving Baidu dropdown menu

 隐藏内容:会员可查看
function getBaiduSuggestion($title) {
    $title = urlencode($title);
    $api = "https://www.baidu.com/sugrec?pre=1&p=1&ie=utf-8&prod=pc&csor=2&wd=".$title."";

    $ch = curl_init();
    curl_setopt_array($ch, [
        CURLOPT_URL => $api,
        CURLOPT_TIMEOUT => 5,
        CURLOPT_RETURNTRANSFER => true,
    ]);

    $r = curl_exec($ch);
    curl_close($ch);

    $r = json_decode($r, true);

    if (!empty($r['g'])) {
        return array_column($r['g'], 'q');
    } else {
        return false;
    }
}

Empire Content Template Call

<h3>相关搜索</h3>
<style>
.searchA{
	padding: 0 10px 6px 0;
	display: block;
}
</style>
<?php 
$otherSearch = getBaiduSuggestion($navinfor['title']);
if($otherSearch){
	foreach($otherSearch as $v){
		echo "<a class='searchA' href='[!--news.url--]moreSearch/".urlencode($v).".html'>$v</a>";
	}
}
?>

Pseudo-static rule modification

rewrite ^/moreSearch/(.*?)\.html$ /e/search/index.php?searchget=1&keyboard=$1&show=title&tempid=1&dopost=search last;

Modification of the code returned by the search page

Header("Location:$public_r[newsurl]e/search/result/?searchid=$searchid".$dogetvar);
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Empire CMS database statement & SQL statement format

Empire CMS database statement & SQL statement format Program Notes Empire cms

Introduction to Imperial CMS extended SQL program writing, basic examples of Imperial CMS database statements & SQL statement formats: Note: The following examples are based on placing PHP files in the system root directory. Example 1: Connect to MYSQL program. (a.php)<?php require('e/class/connect.php'); //Introduce database configuration files and public function files requ…
👁 351
Empire CMS obtains the system COOKIE variable function getcvar()

Empire CMS obtains the system COOKIE variable function getcvar() Program Notes Empire cms

Get the system COOKIE variable function syntax: getcvar($var,$ecms) Description: $var: is the variable name $ecms: 0 is to set the foreground COOKIE variable, 1 is to set the background COOKIE variable. This parameter can be omitted and defaults to 0. Usage example: getcvar('mlusername'), get the user name of the front-end login member getcvar('loginu...
👁 295
Empire CMS smart label call field collection

Empire CMS smart label call field collection Program Notes Empire cms

Collect and classify all fields that support smart tag calls into Empire CMS smart tags: [e:loop={column ID/topic ID, number of items displayed, operation type, only display pictures with titles, additional SQL conditions, display sorting}] Template code content [/e:loop] Calling time: <?=date('m-d',$bqr[newstime])?> <?=dat…
👁 3749

Recommended reading

(Adaptive Mobile Version) Website Publishing Page – pbootCMS Website Template (ID: 1041)

(Adaptive Mobile Version) Website Publishing Page – pbootCMS Website Template (ID: 1041) Practical Collection pbootcms Template

A PbootCMS website template designed for publishing URLs, compatible with both PC and WAP devices. Its clean and practical design makes it ideal for personal or corporate URL navigation and information publishing pages, facilitating the quick sharing and display of important links and information. Template Preview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles: PbootCMS...
👁 54
pbootcms configuration message sent to QQ mailbox tutorial

pbootcms configuration message sent to QQ mailbox tutorial Program Notes PbootCms

1. Log in to your QQ Mail account, then navigate to Settings> Account; 2. Scroll down to find "SMTP Service Settings"; since we are sending emails, either option (the first or the second) is acceptable – both options support SMTP service – select the first option and click "Enable"; 3. For security verification, select "Send SMS" – follow the on-screen instructions to send a SMS from your mobile device; once completed, click "I've Sent"; 4. Remember the authorization code below and copy it to your clipboard...
👁 161
Network Software Technology Company Website Template 0595

Network Software Technology Company Website Template 0595 Practical Collection Yiyou template

This EYO CMS template is ideal for web, software, and technology companies. Its modern, tech-oriented design effectively showcases software products, web services, technical capabilities, and corporate image. It helps technology firms present their brand online and attract business clients. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EYO CMS | EYO CMS (Eyo...
👁 60
(Adaptive mobile version) Women's clothing外贸 website PBootCMS template – Download source code for English-language外贸 websites – 0333

(Adaptive mobile version) Women's clothing外贸 website PBootCMS template – Download source code for English-language外贸 websites – 0333 Practical Collection pbootcms Template

An adaptive mobile-friendly English-language PbootCMS website template for women's wear export trade. Featuring an international and fashionable design style, this template is ideal for women's wear export enterprises to showcase their product ranges and export advantages. It helps Chinese women's wear brands present their brand image in overseas markets and secure international orders. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn...
👁 33
(Adaptive Mobile Version) Navigation Website Template – Website Directory Source Code Download – 1042

(Adaptive Mobile Version) Navigation Website Template – Website Directory Source Code Download – 1042 Practical Collection pbootcms Template

A navigation website and website directory PbootCMS template, compatible with both PC and WAP devices. The clear, categorized design makes it ideal for website directory indexing and URL navigation services. It helps website operators organize online resources, attract users to visit the site, and encourage them to submit new entries for indexing. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.cn | Related Articles...
👁 52
Summary of the lyrics

Summary of the lyrics Hobbies Memo notes

The Rhythm of Qie Point: Qie means a pore, where Qi and blood are deeply stored and accumulated. It is the reaction point of disease syndrome and can provide emergency treatment in clinical situations. The yang dimension connects the yang and the yin dimension builds a guest house. The yang-shoe walks away from the yang, and the yin-shoe crosses the letter. The pores of the lungs are the largest and warmest, and the spleen and stomach are connected to the Liangqiu. The heart and yin are small and old, and the liver and gallbladder are all in the outer mound. Jiaohuizong of Chemen of pericardium, and kidney water spring of Xijinmen. Song of the Jing Xing Yu Yuan Meridian Joint Acupoint Shaoshang Yuji and Taiyuan, passing through the canal Chi Ze Zefei...
👁 187