帝国cms搜索列表页显示搜索相关关键词教程
时间:2024年04月24日
/来源:网络
/编辑:佚名
帝国cms搜索列表页显示搜索相关关键词代码:
动态搜索列表:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = str_replace("searchid=","",$urls);
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sid");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where `keyboard` LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/e/search/result/?searchid='.$tr[searchid].'';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
伪静态版搜索列表代码:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
3、改进版,上边语句比如搜索游戏,会出现 游戏 相关。下边是排除掉了搜索词:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard != '$res[keyboard]' and keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '<a class="related-word-list" href="'.$url.'" target="_blank" style="padding-right: 10px;">'.$tr[keyboard].'</a>';
}
?>
样式自己调整。
自己做得测试结果:
示例页:/d/file/20210918/13.html
http://ecms086.78moban.com/search-0-6.html
示例图:
动态搜索列表:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = str_replace("searchid=","",$urls);
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sid");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where `keyboard` LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/e/search/result/?searchid='.$tr[searchid].'';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
伪静态版搜索列表代码:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '搜索关键词:'.$tr[keyboard].'<br>';
echo '关键词url:'.$url.'<br>';
echo '搜索次数:'.$tr[onclick].'<hr>';
}
?>
3、改进版,上边语句比如搜索游戏,会出现 游戏 相关。下边是排除掉了搜索词:
<?php
$urls = $_SERVER["QUERY_STRING"];
$sid = explode("=",$urls);
$sids = $sid[2];
$res = $empire->fetch1("select * from {$dbtbpre}enewssearch where searchid = $sids");
$sql = $empire->query("select * from {$dbtbpre}enewssearch where keyboard != '$res[keyboard]' and keyboard LIKE '%$res[keyboard]%' ORDER BY onclick DESC");
while($tr=$empire->fetch($sql)){
$url = '/search-0-'.$tr[searchid].'.html';
echo '<a class="related-word-list" href="'.$url.'" target="_blank" style="padding-right: 10px;">'.$tr[keyboard].'</a>';
}
?>
样式自己调整。
自己做得测试结果:
示例页:/d/file/20210918/13.html
http://ecms086.78moban.com/search-0-6.html
示例图:
新闻资讯 更多
- 【帝国cms教程】帝国cms搜索列表页显示搜索相关关键词教程04-24
- 【帝国cms教程】帝国CMS内容页列表页怎么调用多张图片显示04-24
- 【帝国cms教程】帝国cms图片集分割输出全部图片和提取图片集第一张图片代码04-24
- 【帝国cms教程】帝国CMS7.5搜索页面模板不支持灵动标签和万能标签的解决方法04-24
- 【帝国cms教程】帝国cms下载模型里在DownSys/DownSoft/index.php怎么显示真实下载地址?04-24
- 【帝国cms教程】帝国cms导航栏的一级栏目区分是否带有二级栏目而显示不同高亮样式04-24
- 【帝国cms教程】帝国cms灵动标签从第N条开始调用,调用N条的方法04-24
- 【帝国cms教程】记录帝国cms一个判断字段输出语句if04-24
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8帝国cms后台登录出现”您还未登录”怎么解决?
- 9织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法