如何让帝国CMS7.2搜索模板支持动态标签调用

  帝国cms站内搜索一般不支持动态标签调用,如果要调用如何实现呢?修改两个地方就可以实现了。打开 /e/search/result/index.php 文件,找到(文件改了,不会调用也是徒劳!看看这个帝国cms搜索关键字调用标签(showsearch)怎么用)

require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../data/dbcache/class.php");
require("../../class/q_functions.php");
require "../".LoadLang("pub/fun.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");

接着查找:

//替换公共模板变量
$listtemp=$tempr[temptext];

在上面添加以下代码:

//页面支持标签
$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);

  ytkah早就猜到你不想去一行行找了,哈哈,直接提供修改后的整个代码如下

<?php
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../data/dbcache/class.php");
require('../../class/functions.php');
require('../../class/t_functions.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('list'.$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);$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);
?>

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/396181.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

access字体变为斜体_Linux折腾记(四):Linux桌面系统字体配置详解

字体显示效果测试文字&#xff1a;复制代码代码如下:这一段是为了测试宋体字的显示效果&#xff0c;包括宋体里面自带的英文字体&#xff0c;“This is english,how does it look like?”。这一行是小字。后面几个字是加粗的宋体。标点符号“&#xff0c;。&#xff1a;&#…

oracle between and monday,oracle——时间

时间数据1. 插入时间数据插入语法命令&#xff1a;insert into floor values (to_date(年-月-日 时:分:秒,YYYY-MM-DD HH24:MI:SS));完整的时间插入insert into floor values (to_date(2010-07-12 09:10:12,YYYY-MM-DD HH24:MI:SS));查询显示&#xff1a;2010-07-12 09:10:12.0…

Nova 组件详解 - 每天5分钟玩转 OpenStack(26)

本节开始&#xff0c;我们将详细讲解 Nova 的各个子服务。 前面架构概览一节知道 Nova 有若干 nova-* 的子服务&#xff0c;下面我们将依次学习最重要的几个。今天先讨论 nova-api 和 nova-conductor。 nova-api Nova-api 是整个 Nova 组件的门户&#xff0c;所有对 Nova 的请…

肯德基圣代中间空心_建造冰淇淋圣代解释CSS位置

肯德基圣代中间空心by Kevin Kononenko凯文科诺年科(Kevin Kononenko) 建造冰淇淋圣代解释CSS位置 (CSS Positioning Explained By Building An Ice Cream Sundae) 如果您之前做过冰淇淋圣代&#xff0c;那么您可以了解CSS的位置。 (If you’ve made an ice cream sundae befo…

00

&#xff08;1&#xff09;设置gcc 把所有gcc版本解压到/home/flinn/tools/目录下&#xff0c;以免切换编译器export PATHPATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/flinn/tools/4.4.3/bin &#xff08;2&#xff09;编译&#xff1…

12_04_Linux软件管理之四yum

2019独角兽企业重金招聘Python工程师标准>>> RPM安装&#xff1a; 二进制格式&#xff1a; 源程序--》编译--》二进制格式 有些特性是编译时选定的&#xff0c;如果编译时未选定此特性&#xff0c;将无法使用&#xff1b; rpm包的版本会落后于源码包&#xff0c;甚至…

datastage 函数_DataStage常用函数大全

1/38DataStage常用函数大全DATASTAGE常用函数大全.................................................................................................1一、类型转换函数................................................................................................…

linux 解析elf文件格式,Linux下ELF文件解析

1. windows PE文件与Linux ELF文件概述在windows中可执行文件是pe文件格式&#xff0c;Linux中可执行文件是ELF文件&#xff0c;其文件格式是ELF文件格式&#xff0c;在Linux下的ELF文件除了可执行文件(Excutable File),可重定位目标文件(RellocatableObject File)、共享目标文…

富爸爸穷爸爸害了我_这是我必须告诉爸爸的-在我们的时间用完之前

富爸爸穷爸爸害了我by Bram Bos通过Bram Bos 这是我必须告诉爸爸的-在我们的时间用完之前 (This is what I must tell my dad — before our time runs out) I was a young boy in the 1980s. Like the typical Generation-X kid, I grew up in the days of the home computer…

应用容器公共免费部署平台

从网上信息&#xff0c;发现了一个公共的容器部署平台 openshift.com&#xff0c;可以将我们封装好的docker镜像部署到平台上&#xff0c; 这样就不需要拥有一台云服务器了。对于测试环境非常有用。 首先当然是需要注册。这里全英文 第二&#xff0c;注册之后需要选择你想要的套…

西门子rwd68温控器说明书_西门子RWD68说明书

西门子RWD68说明书显示第一界面Y1XX模拟量输出电压值YIXX传感器此时实际温度&#xff1b;同时按—键五秒显示第二界面PS4主控制回路参数&#xff1b;按—键显示第三界面PS3辅助回路参数但仅在室外补偿时出现&#xff1b;按—键显示第四界面PS2按—键显示第五界面PS1控制曲线运用…

linux 内存管理优化,Linux性能优化实战 内存篇 阅读笔记

第十五讲 基础篇&#xff1a;Linux内存是怎么工作的(2020.6.8)这一讲相关的内容正好之前看csapp的时候总结了一下&#xff0c;可以直接贴出来作为总结了。Linux的内存工作原理&#xff0c;这又是一个特别大的话题。一切向着尽量利用物理资源的方向在发展&#xff0c;在没有虚拟…

傅里叶变换与大数乘法

我们知道&#xff0c;两个 N 位数字的整数的乘法&#xff0c;如果使用常规的算法&#xff0c;时间复杂度是 O(N2)。然而&#xff0c;使用快速傅里叶变换&#xff0c;时间复杂度可以降低到 O(N logN loglogN)。 假设我们要计算以下两个 N 位数字的乘积&#xff1a; a (aN-1aN-2…

idea 启动界面导入项目_如何为您的项目启动有效的登录页面

idea 启动界面导入项目by Christian-Peter Heimbach通过克里斯蒂安彼得海姆巴赫 如何为您的项目启动有效的登录页面 (How to launch an effective landing page for your project) I began my career 10 years ago doing online marketing and advertising for video games. S…

linux程序已经在后台运行冻结了_如何使程序在Linux后台运行

经常在Linux上面运行程序都有这样的体验&#xff1a;某个程序运行的时候&#xff0c;会产生大量的log(提示)信息&#xff0c;但实际上我们只想让它跑一下而已&#xff0c;log暂时不需要或者后面才有需要。同时run多个相同或者不同程序的时候&#xff0c;占了好多的命令行界面&a…

数字时代的精益组织

精益IT应该帮助简化和改善我们为客户创造价值的方式&#xff0c;并提出面向未来的更好的解决方案。未来的组织将专注于同行业的产品或业务流——其他的一切&#xff0c;包括专家和管理者在内&#xff0c;都是为了让一线工作人员可以第一时间就做好&#xff0c;而又不会遇到任何…

9th week blog

1、第一个计算机语言&#xff1a;Fortran Fortran I诞生于1957年&#xff0c;由IBM设计&#xff0c;是世界上第一个真正的计算机语言。 Fortran I运行于IBM 704计算机上。 Fortran I支持&#xff1a;变量&#xff08;变量名最多6个字符&#xff09;、If和do语句、格式化IO。 不…

cas单点登录系统:客户端(client)详细配置(包含统一单点注销配置)

最近一直在研究cas登录中心这一块的应用&#xff0c;分享一下记录的一些笔记和心得。后面会把cas-server端的配置和重构&#xff0c;另外还有这几天再搞nginxcas的https反向代理配置&#xff0c;以及cas的证书相关的知识分享出来。 Cas由两部分组成&#xff0c;Cas Server和Cas…

open 端口打开Linux,linux – nmap显示打开的端口,但netstat没有

如果我使用nmap扫描我的服务器,则表明已打开21端口.但是当我登录到这个服务器并运行netstat时,我什么也看不见.$nmap -sT serverStarting Nmap 4.76 ( http://nmap.org ) at 2009-06-24 11:54 MSDInteresting ports on server (x.x.x.x):Not shown: 994 filtered portsPORT STA…

技能学习重要的古语_学习方法:最重要的开发人员技能

技能学习重要的古语by Preethi Kasireddy通过Preethi Kasireddy 学习方法&#xff1a;最重要的开发人员技能 (Learning How to Learn: The Most Important Developer Skill) Being an efficient learner is at least as important as being an efficient coder.成为高效的学习…