当前位置: 首页 > cms教程

帝国CMS开启全站搜索功能的步骤和方法

时间:2026-01-30 12:03:16

1、修改默认的搜索标签

地址改成:e/sch/index.php,post改成get,删除select


<divclass="search"><formaction="[!--news.url--]e/sch/index.php"method="get"name="searchform"id="searchform"><inputname="keyboard"id="keyboard"class="input_text"value="请输入关键字词"style="color:rgb(153,153,153);"onfocus="if(value=='请输入关键字词'){this.style.color='#000';value=''}"onblur="if(value==''){this.style.color='#999';value='请输入关键字词'}"type="text"><inputname="show"value="title"type="hidden"><inputname="tempid"value="1"type="hidden"><inputname="Submit"class="input_submit"value="搜索"type="submit"></form></div>

2、开启全站搜索

3、导入数据


4、修改模板-公共模板-全站搜索模板 第二个


<!doctypehtml><html><head><metacharset="utf-8"><title>[!--pagetitle--]_<?=$public_r[sitename]?></title><metaname="keywords"content="[!--pagekey--]"/><metaname="description"content="[!--pagedes--]"/><metaname="viewport"content="width=device-width,initial-scale=1.0"><linkhref="[!--news.url--]skin/html/css/base.css"rel="stylesheet"><linkhref="[!--news.url--]skin/html/css/m.css"rel="stylesheet"><scriptsrc="[!--news.url--]skin/html/js/jquery-3.6.0.min.js"></script><scriptsrc="[!--news.url--]skin/html/js/m.js"></script></head><body>[!--temp.header--]<divclass="box"><divclass="blogs_search"><divclass="weizhi">您现在的位置是:<ahref="[!--news.url--]">首页</a>>搜索结果</div><divclass="xt_search">系统搜索到以下文章符合<strong>[!--keyboard--]</strong>的查询结果</div><ul>[!--empirenews.listtemp--]<li><h2><ahref="[!--titleurl--]"target="_blank">[!--no.num--].[!--title--]</a></h2><p>[!--smalltext--]</p><spanclass="color_green">[!--titleurl--]-[!--newstime--]</span></li>[!--empirenews.listtemp--]</ul><divclass="epages">[!--listpage--]</div></div><asideclass="rbox">[!--temp.tuijian(all)--]</aside><divclass="clear"></div></div>[!--temp.footer--]</body></html>

5、修改文件,让动态页面支持标签调用


找到/e/class/functions.php的大概第4768行或搜索“ReSchAlltemp()”这个函数,在$pagetitle=$fun_r['SearchAllNav'];下面添加以下代码://----支持标签调用$pr['schalltemp']=DtNewsBq('lists'.$tempid,$pr['schalltemp'],0);


上一篇:去除帝国CMS搜索页面关键字加红的方法
下一篇:帝国CMS管理员帐号、密码、认证码及安全答案忘记的解决办法
请输入 字词 模板
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器
  • 英特尔第五代 Xeon CPU 来了:详细信息和行业反应
  • 由于云计算放缓引发扩张担忧,甲骨文股价暴跌
  • Web开发状况报告详细介绍可组合架构的优点
  • 如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳
  • 美光在数据中心需求增长后给出了强有力的预测
  • 2027服务器市场价值将接近1960亿美元
  • 生成式人工智能的下一步是什么?
  • 分享在外部存储上安装Ubuntu的5种方法技巧
  • 全球数据中心发展的关键考虑因素
  • 英特尔与 Vertiv 合作开发液冷 AI 处理器

    英特尔第五代 Xeon CPU 来了:详细信息和行业反应

    由于云计算放缓引发扩张担忧,甲骨文股价暴跌

    Web开发状况报告详细介绍可组合架构的优点

    如何使用 PowerShell 的 Get-Date Cmdlet 创建时间戳

    美光在数据中心需求增长后给出了强有力的预测

    2027服务器市场价值将接近1960亿美元

    生成式人工智能的下一步是什么?

    分享在外部存储上安装Ubuntu的5种方法技巧

    全球数据中心发展的关键考虑因素