web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 地图大全
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

帝国cms搜索模板支持调用动态标签方法

756 ℃

复制以下代码到e/search/result/index.php

<?php require('../../class/connect.php');require('../../class/db_sql.php');require('../../class/functions.php');require('../../class/t_functions.php');require('../../data/dbcache/class.php');require "../".LoadLang("pub/fun.php");$editor=1;eCheckCloseMods('search');//关闭模块 $link=db_connect();$empire=new mysqlquery();$getvar=$_GET['getvar'];if(empty($getvar)) { $getfrom="history.go(-1)";} else { $getfrom="../../../search/";}//搜索结果 $searchid=(int)$_GET['searchid'];if(empty($searchid)) { printerror("SearchNotRecord",$getfrom,1);} $search_r=$empire->fetch1("select searchid,keyboard,result_num,orderby,myorder,tbname,tempid,andsql,trueclassid from {$dbtbpre}enewssearch where searchid='$searchid'");if(empty($search_r['searchid'])||InfoIsInTable($search_r[tbname])) { printerror("SearchNotRecord",$getfrom,1);} $page=(int)$_GET['page'];$page=RepPIntvar($page);$start=0;$page_line=$public_r['search_pagenum'];//每页显示链接数 $line=$public_r['search_num'];//每页显示记录数 $offset=$page*$line;//总偏移量 $search="&searchid=".$searchid;$myorder=$search_r[orderby];if(empty($search_r[myorder])) { $myorder.=" desc";} $add=stripSlashes($search_r['andsql']);$num=$search_r[result_num];$query="select * from {$dbtbpre}ecms_".$search_r[tbname].($add?' where '.substr($add,5):'');$query.=" order by ".$myorder." limit $offset,$line";$sql=$empire->query($query);$listpage=page1($num,$line,$page_line,$start,$page,$search);//取得模板 if($search_r['tempid']) { $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."' limit 1");} elseif(empty($class_r[$search_r[trueclassid]][searchtempid])) { $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");} else { $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");} $have_class=1;//页面支持标签 $tempr[temptext]=DtNewsBq('listsearch'.$search_r['tempid'],$tempr[temptext],0);//替换公共模板变量 $listtemp=$tempr[temptext];if($public_r['searchtempvar']) { $listtemp=ReplaceTempvar($listtemp);} $search_r[keyboard]=ehtmlspecialchars($search_r[keyboard]);$listtemp=str_replace("[!–show.page–]",$listpage,$listtemp);$listtemp=str_replace("[!–keyboard–]",$search_r[keyboard],$listtemp);$listtemp=str_replace("[!–ecms.num–]",$num,$listtemp);$url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a>&nbsp;>&nbsp;".$fun_r['adsearch'];$pagetitle=$fun_r['adsearch']." ".$search_r[keyboard];$listtemp=ReplaceSvars($listtemp,$url,0,$pagetitle,$pagetitle,$pagetitle,$add,0);$rownum=$tempr[rownum];if(empty($rownum)) { $rownum=1;} $formatdate=$tempr[showdate];$subnews=$tempr[subnews];$subtitle=$tempr[subtitle];$docode=$tempr[docode];$modid=$tempr[modid];$listvar=str_replace('[!–news.url–]',$public_r[newsurl],$tempr[listvar]);//字段 $ret_r=ReturnReplaceListF($tempr[modid]);//取得列表模板 $list_exp="[!–empirenews.listtemp–]";$list_r=explode($list_exp,$listtemp);$listtext=$list_r[1];$no=$offset+1;$changerow=1;while($r=$empire->fetch($sql)) { //替换列表变量 $repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode);$listtext=str_replace("<!–list.var".$changerow."–>",$repvar,$listtext);$listtext=str_replace($search_r[keyboard],"<font color='red'>$search_r[keyboard]</font>",$listtext);$changerow+=1;//超过行数 if($changerow>$rownum) {$changerow=1;$string.=$listtext;$listtext=$list_r[1];} $no++;} db_close();$empire=null;//多余数据 if($changerow<=$rownum&&$listtext<>$list_r[1]) { $string.=$listtext;} $string=$list_r[0].$string.$list_r[2];echo stripSlashes($string);?>

利用php语法做一个限流访问(排除指定IP)

javascript+php语法获取ip地址的相关信息

利用php语法实现一个哔哩哔哩热榜api

php删除接口:在指定的数据库数据表中根据ID删除指定的数据

php插入接口:在指定的数据库数据表中插入数据

标签: class functions php语法 require

上面是“帝国cms搜索模板支持调用动态标签方法”的全面内容,想了解更多关于 帝国cms 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_807.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > 帝国cms
本文共计3946个字,预计阅读时长27分钟
Trae:新一代免费的AI编程工具

生活小工具

收录了万年历、老黄历、八字智能排盘等100+款小工具!生活小工具
上一篇: 抖音联合方正打造免费可商用品牌字体——抖音美好体
下一篇: 推荐一个在线图文转视频、AI 数字人工具——一帧秒创(免费赠送100分钟)
x 打工人ai神器