如何讓帝國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.pswp.cn/news/396181.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/396181.shtml
英文地址,請注明出處:http://en.pswp.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.成為高效的學習…