Hongmu Notes
Home Program Notes Empire cms8.0 search list page supports dynamic php code display
Program Notes Empire cms PHP Summary of pitfalls

Empire cms8.0 search list page supports dynamic php code display

Empire cms8.0 search list page supports dynamic php code display

Empire cms updated to 8.0.

During daily use, I discovered that this search list page does not support dynamic php code display, so I modified the code and put it here.

<?php
require("../../class/connect.php");
require("../../data/dbcache/class.php");
//require("../../class/q_functions.php");这里注释掉了,www.daixiao360.cn
require("../../class/functions.php");//这里新增,www.daixiao360.cn
require('../../class/t_functions.php');//这里新增,www.daixiao360.cn
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);
}
//搜索用户组
if($public_r['searchgroupid'])
{
	include('../../member/class/user.php');
	@include("../../data/dbcache/MemberLevel.php");
	$user=islogin();
	$mvgresult=eMember_ReturnCheckMVGroup($user,$public_r['searchgroupid']);
	if($mvgresult<>'empire.cms')
	{
		printerror("NotLevelToSearch",$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);
}
if(!eInfoHaveTable($search_r['tbname'],0))
{
	printerror("SearchNotRecord",$getfrom,1);
}
$search_r['tempid']=(int)$search_r['tempid'];

$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$page_line=(int)$public_r['search_pagenum'];//每页显示链接数
$line=(int)$public_r['search_num'];//每页显示记录数
$offset=$page*$line;//总偏移量
if($offset>$public_r['searchupnum'])
{
	printerror("SearchNotRecord",$getfrom,1);
}
$search="&searchid=".$searchid;
$myorder=$search_r['orderby'];
if(empty($search_r['myorder']))
{
	$myorder.=" desc";
}
$add=stripSlashes($search_r['andsql']);
$num=$search_r['result_num'];
// if(strstr($add,"")||strstr($search_r['andsql'],""))
// {
// 	exit();
// }
//ids
$pageids=eGetidsLimitMlen($search_r['andsql'],10,$line,$page,1);
if(!$pageids)
{
	printerror("SearchNotRecord",$getfrom,1);
}
$query="select * from {$dbtbpre}ecms_".$search_r['tbname']." where id in (".$pageids.")";
//$query.=" order by ".$myorder."".do_dblimit($line,$offset);
$query.=" order by ".$myorder."";
$sql=$empire->query($query);
$listpage=page1($num,$line,$page_line,$start,$page,$search);
//取得模板
if($search_r['tempid'])
{
	$tempr=$empire->fetch1("select temptext,subnews,listvar,".do_dbkeyfield_spe('rownum').",showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."'".do_dblimit_one());
}
elseif(empty($class_r[$search_r['trueclassid']]['searchtempid']))
{
	$tempr=$empire->fetch1("select temptext,subnews,listvar,".do_dbkeyfield_spe('rownum').",showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1".do_dblimit_one());
}
else
{
	$tempr=$empire->fetch1("select temptext,subnews,listvar,".do_dbkeyfield_spe('rownum').",showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r['trueclassid']]['searchtempid']."'".do_dblimit_one());
}
$have_class=1;
//替换公共模板变量
$tempr['temptext']=DtNewsBq('listsearch'.$search_r['tempid'],$tempr['temptext'],0);////这里新增,www.daixiao360.cn 
$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,$addr,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))
{
	//替换列表变量
$r['title']=str_replace($search_r['keyboard'],"<font color='red'>{$search_r['keyboard']}</font>",$r['title']);////这里新增,www.daixiao360.cn 
	$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);
?>

 

Download address
📥
Official Download
Download Now
UTF-8版本
Download now
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

EmpireCMS uses PHP to directly submit data for updating articles.

EmpireCMS uses PHP to directly submit data for updating articles. Program Notes Empire cms Language Notes PHP

Submitted code: While having some free time, I took the time to thoroughly study the Train Engine module and integrate it with Empire CMS, resulting in the following code. Experienced PHP developers are welcome to modify this code; however, this is merely a simple submission script – the data must be configured manually! <?php $url = "http://www.4s5.cn/e/admin/123.php"; // Replace this with the actual URL where the data should be received...
👁 385
Empire CMS database statement & SQL statement format

Empire CMS database statement & SQL statement format Program Notes Empire cms

Introduction to Imperial CMS extended SQL program writing, basic examples of Imperial CMS database statements & SQL statement formats: Note: The following examples are based on placing PHP files in the system root directory. Example 1: Connect to MYSQL program. (a.php)<?php require('e/class/connect.php'); //Introduce database configuration files and public function files requ…
👁 351
Empire CMS obtains the system COOKIE variable function getcvar()

Empire CMS obtains the system COOKIE variable function getcvar() Program Notes Empire cms

Get the system COOKIE variable function syntax: getcvar($var,$ecms) Description: $var: is the variable name $ecms: 0 is to set the foreground COOKIE variable, 1 is to set the background COOKIE variable. This parameter can be omitted and defaults to 0. Usage example: getcvar('mlusername'), get the user name of the front-end login member getcvar('loginu...
👁 295
Empire CMS smart label call field collection

Empire CMS smart label call field collection Program Notes Empire cms

Collect and classify all fields that support smart tag calls into Empire CMS smart tags: [e:loop={column ID/topic ID, number of items displayed, operation type, only display pictures with titles, additional SQL conditions, display sorting}] Template code content [/e:loop] Calling time: <?=date('m-d',$bqr[newstime])?> <?=dat…
👁 3748

Recommended reading

Marketing environmentally friendly shell powder ecological paint website template 0134

Marketing environmentally friendly shell powder ecological paint website template 0134 Practical Collection Yiyou template

An eyoucms website template for marketing-oriented environmentally friendly shell powder ecological paint companies. The design style is green and environmentally friendly, and can display shell powder coating products, coating effects and engineering cases. It helps coating companies promote green building materials online and attract home decoration and engineering customers. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Yiyou CMS installation...
👁 52
php split a string into its constituent characters

php split a string into its constituent characters Language Notes PHP

Question: How to split a string into its constituent characters in PHP? For example, hello -> [h, e, l, l, o] There are three methods: This is the string that needs to be split: $str = 'Hello sample'; The length of the string: $len = mb_strlen($str, 'utf8'); // 7 The first way: $arr = str_…
👁 182
Express moving and shipping company website template 0372

Express moving and shipping company website template 0372 Practical Collection Yiyou template

An eyoucms website template for the express delivery, moving and shipping company industries. The design style is efficient and professional, and can showcase express delivery services, moving solutions, shipping business and corporate strength. Helps express moving companies to display their brands online and attract individual and corporate customers. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Yiyou CMS installation...
👁 51
Responsive automation equipment technology enterprise website template 0619

Responsive automation equipment technology enterprise website template 0619 Practical Collection Yiyou template

This set of eyoucms responsive templates is suitable for automation equipment technology companies. It has a cutting-edge design style and can display automation equipment products, technical solutions and industrial applications. It helps automation technology companies display their brands online and attract manufacturing customers. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Yiyou CMS installation FAQ summary Yiyou CMS (…
👁 52
Responsive furniture custom website template 0879

Responsive furniture custom website template 0879 Practical Collection Yiyou template

This set of eyoucms responsive templates is suitable for furniture customization companies. The design style is high-end and modern, and can display the whole house customization furniture, design cases and brand strength. It helps customized furniture brands attract owners online and enhance their brand image. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Eyou CMS installation Eyou CMS (EyouC…
👁 43