帝国CMS漫游笔记

视频教程集

帝国cms7.5仿站系列教程

https://www.bilibili.com/video/BV1FM4y1K7eS?p=14

帝国CMS管理首页方案设置教程https://www.kaituozu.com/ecms-temp-indexfun.html

 

 

仿站网:http://www.fangzhan.org/diguocmsjiaocheng.html

 

帝国cms常用标签

标题: <?=$bqr[title]?>

标题链接: <?=$bqsr[titleurl]?>

截取标题字数: <?=esub($bqsr[title],120)?>

栏目名字: <?=$bqsr[classname]?>

栏目链接: <?=$bqsr[classurl]?>

标题图片: <?=$bqr[titlepic]?>

截取简介字数: <?=esub(bqr[smalltext],120)?>

时间: <?=date(“Y-m-d H:i:s”,$bqr[newstime])?>

点击: <?=$bqr[onclick]?>

 

帝国cms幻灯片

<div class="bd">

<ul>

[e:loop={0,8,3,0,'','newstime DESC'}]

<li><a title="<?=$bqr['title']?>" target="_blank" href="<?=$bqsr['titleurl']?>"><img title="<?=$bqr['title']?>" src="<?=$bqr[titlepic]?>" /><span class="txtbg"> </span><span class="txt"><?=$bqr['title']?></span></a></li>

[/e:loop]

</ul>

</div>

 

 

 

 

 

 

 

帝国CMS用灵动标签实现各种幻灯(焦点图)效果的方法

 

帝国CMS用灵动标签实现各种幻灯(焦点图)效果的方法

 FLASH幻灯制作一般流程:

1、将幻灯代码内容和FLASH相关文件复制本地;

2、显示信息内容用灵动标签调用出来; 常见的FLASH幻灯有下面两种方式及灵动标签调用例子: 示例一、分开显示式,如下面这类:filesarr[1] = "/d/file/20110509/0ea97d787d559b4fa207b40928dca573.jpg";linksarr[1] = "/Photography/12432934312103.html";textsarr[1] = "标题1";filesarr[2] = "/d/file/20110509/f390adb68aaaca13d306fd16d8b600a2.jpg";linksarr[2] = "/Photography/12444403612122.html";textsarr[2] = "标题2";filesarr[3] = "/d/file/20110509/ad3fd33cccb9fe2dea55223efff51abb.jpg";linksarr[3] = "/logodesign/12445146952128.html";textsarr[3] = "标题3";

 

用灵动标签调用出上面内容,可以用下面代码:

[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片}]filesarr[<?=$bqno?>] = "<?=$bqr[titlepic]?>";linksarr[<?=$bqno?>] = "<?=$bqsr[titleurl]?>";textsarr[<?=$bqno?>] = "<?=$bqr[title]?>";

[/e:loop]

(如果序号是从0开始,则用<?=$bqno-1?>) 示例二、连接显示式,如下面这类:var pics="/d/file/07b40928dca573.jpg|/d/file/306fd16d8b600a2.jpg|/d/file/223efff51abb.jpg";var links="/Photography/12432934312103.html|/Photography/12444403612122.html|/logodesign/12445146952128.html";var texts="标题1|标题2|标题3";用灵动标签调用出上面内容,可以用下面代码:[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片}]<?php$jg='|';if($bqno==1){$jg='';}$pics.=$jg.$bqr['titlepic'];$titles.=$jg.$bqr['title'];$urls.=$jg.$bqsr['titleurl'];?>[/e:loop]var pics="<?=$pics?>";var links="<?=$urls?>";var texts="<?=$titles?>"; 其他格式依此类推,都可以用灵动标签调用出来。

 

帝国cms 灵动标签首页幻灯片调用实现方法

<div class="focusBox" style="margin:0 auto">

 <ul class="pic">

 [e:loop={8,4,1,1}]<li><a href="<?=$bqr[titleurl]?>" target="_blank"><img src="<?=$bqr[titlepic]?>"/></a></li>[/e:loop]

</ul>

 <div class="txt-bg"></div>

 <div class="txt"> 

<ul>

 [e:loop={8,4,1,1}]<li><a href="<?=$bqr[titleurl]?>"><?=$bqr[title]?></a></li>[/e:loop]

</ul> 

</div> 

<ul class="num"> 

<li><a>1</a><span></span></li>

 <li><a>2</a><span></span></li>

 <li><a>3</a><span></span></li> 

<li><a>4</a><span></span></li> 

</ul>

 </div>

 <script type="text/javascript"> jQuery(".focusBox").slide({ titCell:".num li", mainCell:".pic",effect:"fold", autoPlay:true,trigger:"click",startFun:function(i){ jQuery(".focusBox .txt li").eq(i).animate({"bottom":0}).siblings().animate({"bottom":-36});}});

</script>

 </div>

 

 

帝国cms如何做搜索模板?

第一步:先登录帝国cms后台---模板---公共模板---横向搜索js模板---在这里将您的搜索模板复制粘贴到这里

 

<div class="search">

<form name="search_js1" method="post" action="[!--news.url--]e/search/index.php" nsubmit='return search_check(document.search_js1);'>

<div class="input-group">

<select id="rid" style="display: none" name=show>

<option value=title selected="selected">标题</option>

<option value=title,smalltext,newstext,writer>搜索全部</option>

</select>

<input class="form-control" size=32 name=keyboard placeholder="请输入您要查找的关键词" type=text>      

<span class="input-group-btn">

<button id="searchsubmit" name=Submit type=submit class="btn btn-default" style="border:1px solid #c81b23"><i class="fa fa-search-plus"></i></button>

</span>

</div>

</form>

</div>

 

这里面注意两个地方必须要有:

<select id="rid" style="display: none" name=show>

<option value=title selected="selected">标题</option>

<option value=title,smalltext,newstext,writer>搜索全部</option>

</select>

帝国CMS实现全站搜索功能的方法

<form name="searchform" method="post" action="[!--news.url--]e/search/index.php" target="_blank">

<input type="text" name="keyboard" placeholder="搜索框提示语">

<input type="hidden" name="tbname" value="news">

<input type="hidden" name="show" value="title">

<input type="hidden" name="tempid" value="1">

<input type="submit" value="搜索">

</form>

帝国cms搜索提示页面界面

很大气收集的信息提示页面模板

使用方法:解压出来的index.php文件替换 e/message/index.php 文件。

压缩包包含 GBK和UTF8两个编码!

 

点击附件下载:index.php

 

帝国网站统计前台显示版

帝国老大发布了一个帝国网站流量统计插件,只能在网站后台查看流量统计,今天这里给大家分享一个文件,可以与帝国老大发布的网站流量统计插件结合,实现网站前台显示网站的总ipl流量和总pv流量,以及日ip流量和日pv流量:(如要使用此功能,必须先安装帝国老大发布的网站流量统计插件)

具体代码

<?php
require('../../class/connect.php');        //引入数据库配置文件和公共函数文件
require('../../class/db_sql.php');        //引入数据库操作文件
require("../../class/functions.php");
$link=db_connect();                //连接MYSQL
$empire=new mysqlquery();        //声明数据库操作类

//总访问量、总浏览量、今日访问、今日浏览

$r=$empire->fetch1("select sum(ipnum) as vipnum,sum(pvnum) as vpvnum from {$dbtbpre}ecmsextend_stats limit 1");
$rr=$empire->fetch1("select ipnum,pvnum from {$dbtbpre}ecmsextend_stats order by tday desc limit 1");
?>

  document.write('<li>总访问量:<?=$r[vipnum]?>人次</li>');
  document.write('<li>总浏览量:<?=$r[vpvnum]?>人次</li>');
  
  document.write('<li>今日访问:<?=$rr[ipnum]?>人次</li>');
  document.write('<li>今日浏览:<?=$rr[pvnum]?>人次</li>');

<?php
db_close();                        //关闭MYSQL链接
$empire=null;                        //注消操作类变量
?>

 

复制上面的代码保存为了stats.php文件,放到网站/e/extend/stats/目录下面,

在需要显示网站统计的地方放如下代码:

<script src=[!--news.url--]e/extend/stats/stats.php></script>

具体看下面的截图

 

 

帝国cms7.5在线表单提交制作方法

今天给大家讲解一下帝国CMS7.5的用户提交表单,比如在线报名、反馈信息、留言等,可以帮助我们获得用户的信息,从而带来业务,实现方法如下:

制作出来的效果如下:

 

 

 

方法步骤:

1、点击菜单栏的【插件】选项,然后再选择【信息反馈管理】中的【管理反馈分类】选项,在右侧点击【增加反馈分类】即可;注意,如果不增加,直接用默认系统的默认即可,理论上讲信息反馈分类是可以添加无数个的。

2、进入【增加反馈分类】页面,填写【分类名称】,勾选需要的表单选项,也可以在【字段管理】里面【新建字段】,然后提交即可;

3、将代码添加到需要表单的地方,在代码复制中需要替换的主要有以下两点需要特别注意:

<form name='feedback' method='post' enctype='multipart/form-data' action='[!--news.url--]e/enews/index.php'>

<input type=hidden name=bid value=2>

<input type="hidden" name="ecmsfrom" value="url ">

<input name='enews' type='hidden' value='AddFeedback'>

在上面的代码中需要注意action的值以及添加value提交值,其中value=?是表单的ID;value="url "中url可以填写“/”也可以填写主页地址,其中<input type="hidden" name="ecmsfrom" value="url ">的意思是反馈表单提交后返回到首页!

4、将制作好的表单模板粘贴到自定义单页模板即可;

另外将上面截图的表单代码贴出来,供大家学习使用(春哥仿站团队用的是默认信息反馈分类)

 

<form class="form index-form" name='feedback' method='post' enctype='multipart/form-data'

action='../../e/enews/index.php'>

<div class="form-title">免费预约</div>

<input type="hidden" name="ecmsfrom" value="<?=$public_r['add_www.cgtblog.com.mwebsite']?>">

<input name='enews' type='hidden' value='AddFeedback'>

<input name='title' type='hidden' value='网站留言'>

<div class="form-group">

<input class="form-control name" type="text" name="name" placeholder="请输入您的姓名..." data-required="true"

data-descriptions="name" value="">

</div>

<div class="form-group">

<input type="text" class="form-control phone" name="mycall" placeholder="请输入您的联系方式..." data-required="true"

data-pattern="^0?1[0-9][0-9]\d{8}$" data-descriptions="telphone" value="">

</div>

<div class="form-group">

<input type="text" class="form-control" name="address" placeholder="请输入您的地址..." value=''>

</div>

<div class="form-group">

<input type="text" class="form-control area" name="saytext" placeholder="请输入您的需求..." data-required="true"

data-descriptions="area">

</div>

<button class="btn btn-primary btn-block">立即预约</button>

<div class="form-phone">预约电话: <span><?=$public_r['add_www.cgtblog.com.guhua']?></span></div>

</form>

 

帝国cms高危SQL注入漏洞(盲注)系统自带RepPIntvar过滤函数使用方法

 

帝国cms源码开发的时候很多时候要用到$_GET过来的参数,在处理的时候如果不严谨容易被发现利用,给系统整体安全带来影响。

帝国cms系统本身有自带了过滤函数RepPIntvar,传递过来的字段加上过滤可以给安全加分。

错误的写法:$title = $_GET['id'] ; 未经过滤存在SQL注入漏洞风险

正确的写法:$title = RepPIntvar($_GET['id']); 对传过来的字段进行过滤。

这样在一些安全检测上会加分,不会存在检查SQL注入漏洞。

帝国CMSRepPIntvar()

function RepPIntvar($val){

    $val=intval($val);

    if($val<0)

    {

        $val=0;

    }

    return $val;

}

函数 RepPIntvar()
功能 将变量值转为正值得整形。
位置 e/class/connect.php
版本 7.0

帝国CMS7.5搜索页面模板不支持灵动标签和万能标签的解决方法

1,打开 /e/search/result/index.php 文件

查找

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");

 

 

2,再查找

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

在上面添加如下代码

//新增支持灵动标签和万能标签
$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);

修改完成,这样就可以在搜索模板中灵活使用帝国CMS强大的灵动和万能标签了

定要刷新一下:清除临时文件和数据

 

 

帝国CMS7.5在PHP7.x环境登录后台报错的解决方法

以下是帝国CMS官方说明!

使用PHP7.*运行环境时,以下两种情况,设置支持PHP7.*操作步骤:

1、全新安装帝国CMS时:

只需安装时MYSQL接口类型选择mysqli即可支持PHP7系列。

2、已经安装好帝国CMS换PHP7.*运行环境时:

只需修改配置文件/e/config/config.php;将$ecms_config['db']['usedb']='mysql';修改为$ecms_config['db']['usedb']='mysqli';即可支持PHP7系列。(注意事项:UTF8文件不能用记事本修改文件,否则会将文件转为GBK编码,推荐用Dreamweaver修改。)

 

3、php.ini配置问题,按下面修改即可解决:(记得改完重启环境)

修改php.ini,把error_reporting = E_ALL改成

error_reporting = E_ALL & ~E_NOTICE

4、如果修改上述不能解决问题,报错依旧。请继续修改PHP.ini文件 把display_errors = ON改成display_errors = Off即可了!

帝国cms提取内容图片第一张为标题图片

可以自动在内容页或列表页获取内容的图片

<?php

$sql=$empire->query("select * from {$dbtbpre}ecms_news order by onclick desc limit 1");

while($r=$empire->fetch($sql)){

$text=GetTxtFieldText($r[newstext]); //获取正文内容

$text1=substr($text,12);//去除exit

$datanr=stripslashes($text1); //册除反

$pattern ="/.*src=\\"([^^]*?)\\".*/i"; //正则取图片

preg_match_all($pattern,$datanr,$matchess);

$diypic=$matchess[1][0]; //取第一张图片地址

?>

<img src="<?=$diypic?>">

<?}?>

帝国cms仿站之内容页列表页怎么调用多张图片显示

帝国cms仿站之内容页列表页怎么调用多张图片显示,在实际的帝国cms仿站过程中,我们经常会遇到内容页或列表页需要调用文章内容中多张图片显示的情况,具体该怎么做的,下面仿站网分享代码如下:

[e:loop={'news',10,18,1}]     

<?php

$fr=$empire->fetch1("select newstext from {$dbtbpre}ecms_news_data_{$bqr[stb]} where id='$bqr[id]'");

$str=stripcslashes($fr['newstext']);

preg_match_all('/<img.*?src="(.*?)".*?>/is',$str,$imgArr);

$imgArr = array_unique($imgArr[1]);

?>

<?=count($imgArr)?>张                        

<img src="<?=$imgArr[0]?>"  width="200" height="200" />

<img src="<?=$imgArr[1]?>" width="200" height="200" />

<img src="<?=$imgArr[2]?>" width="200" height="200" />

<a href="<?=$bqsr['titleurl']?>"><?=$bqr['title']?></a><br>

[/e:loop]

 

帝国CMS仿站教程之帝国CMS后台忘记密码怎么找回

帝国CMS仿站教程之帝国CMS后台忘记密码怎么找回?忘记密码是帝国cms系统使用过程中常见的问题,忘记密码不要着急和担心,因为帝国cms忘记后台密码是很容易找回的,具体找回方法如下:

  1:进入phpmyadmin

  2:找到 phome_enewsuser 数据表

  phome为数据库表前缀

  3:修改 phome_enewsuser 表中的如下四个字段的值

  username:admin

  password:28faed7bf0c97624ad3b8737b6947e41

  salt:fy1rWNIJ

  salt2:pzNVrEdbkRJ2W6bvxpVo

  

 

 

  修改完后,后台的账号为:admin 密码:admin888,重新登陆后你就可以设置新的密码了

 

帝国cms最新文章显示红色日期的解决方法

首先,要在模板中选中“使用程序代码”。
然后,在列表内容模板(list.var)框中,添加如下代码:
 

复制代码代码如下:

$newimg='[!--newstime--]';
if(time()-$r[newstime]<=1*24*3600)
{
        $newimg='<font color=red>[!--newstime--]</font>';

$listtemp='<li><span class="date">'.$newimg.'</span> <a href="[!--titleurl--]" target=_blank>[!--title--]</a> </li>';

或者使用灵动标签

<ul>
[e:loop={'news',15,18,0}]
<?
$newstime=format_datetime($bqr[newstime],'m-d');
if(date('Y-m-d')==date('Y-m-d',$bqr[newstime]))
{
$newstime="<font color=red>$newstime</font>";
}
?>
<li>[<a href="<?=$bqsr[classurl]?>"><?=$bqsr[classname]?></a>] <a href="<?=$bqsr[titleurl]?>"><?=esub($bqr[title],40)?></a><span><?=$newstime?></span></li>
[/e:loop]
</ul>

 

帝国CMS翻页 上一页下一页调用方法集合

帝国CMS自带模板变量

上一篇:[!--info.pre--]

下一篇:[!--info.next--]

缺点:[!--info.pre--] 和 [!--info.next--] 中封装的 <a>标签的内容无法定制

灵动标签+SQL语句

[e:loop={"select * from [!db.pre!]ecms_news where id<'$navinfor[id]' and classid='$navinfor[classid]' order by id desc limit 1",1,24,0}]

上一篇:<a href="<?=$bqsr[titleurl]?>" title="上一篇:<?=$bqr[title]?>" target="_blank">  ☜  </a>

[/e:loop]

[e:loop={"select * from [!db.pre!]ecms_news where id>'$navinfor[id]' and classid='$navinfor[classid]' order by id limit 1",1,24,0}]

下一篇:<a href="<?=$bqsr[titleurl]?>" title="下一篇<?=$bqr[title]?>" target="_blank">☞</a>

[/e:loop]

 

纯灵动标签

[e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]

<a href="<?php 

echo $bqsr[titleurl];

$pre='true';

?>">上一篇:<?=$bqr[title]?>

</a>

[/e:loop]

<?php 

if(empty($pre)){

echo "上一篇:很抱歉没有了";

}

?>

[e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}]

<a href="<?php 

echo $bqsr[titleurl];

$next='true';

?>">下一篇:<?=$bqr[title]?>

</a>

[/e:loop]

<?php 

if(empty($next)){

echo "下一篇:很抱歉没有了";

}

?>

动态调用

<a href="/e/public/GotoNext?classid=[!--self.classid--]&id=[!--id--]&enews=pre">上一篇文章</a>

<a href="/e/public/GotoNext?classid=[!--self.classid--]&id=[!--id--]&enews=next">下一篇文章</a>

 

帝国cms内容页代码/语法高亮改造方法_简单实用

1、下载SyntaxHighlighter并解压到您的帝国cms网站根目录即可。

2、复制下面的代码到帝国cms内容页模板里。

1

2

3

4

5

<link href="[!--news.url--]SyntaxHighlighter/shCoreDefault.css" rel="stylesheet" type="text/css" /> 

<script type="text/javascript" src="[!--news.url--]SyntaxHighlighter/shCore.js"></script

<script type="text/javascript"> 

 SyntaxHighlighter.all(); 

</script>

3、在编辑器里面选择源码添加代码片段,增加标签<pre></pre>,修改样式就行,也就是在发布有代码的文章时,点击:源码-->在需要插入代码的位置,插入下面对应代码的<pre>代码</pre>标签-->,再切换到非源码界面,替换代码即可,所有支持语法高亮的代码语言都整理了一个列表,如下:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

<pre class="brush:as3;toolbar:false">ActionScript3</pre>

<pre class="brush:bash;toolbar:false">Bash/Shell</pre>

<pre class="brush:css;toolbar:false;">Css</pre>

<pre class="brush:cpp;toolbar:false;">C/C++</pre>

<pre class="brush:cf;toolbar:false">CodeFunction</pre>

<pre class="brush:c#;toolbar:false">C#</pre>

<pre class="brush:delphi;toolbar:false">Delphi</pre>

<pre class="brush:diff;toolbar:false">Diff</pre>

<pre class="brush:erlang;toolbar:false">Erlang</pre>

<pre class="brush:groovy;toolbar:false;">Groovy</pre>

<pre class="brush:html;toolbar:false">Html</pre>

<pre class="brush:java;toolbar:false">Java</pre>

<pre class="brush:jfx;toolbar:false">JavaFx</pre>

<pre class="brush:js;toolbar:false">javascript</pre>

<pre class="brush:pl;toolbar:false">perl</pre>

<pre class="brush:php;toolbar:false">php</pre>

<pre class="brush:plain;toolbar:false">plainText</pre>

<pre class="brush:ps;toolbar:false">PowerShell</pre>

<pre class="brush:python;toolbar:false">Python</pre>

<pre class="brush:ruby;toolbar:false">Ruby</pre>

<pre class="brush:scala;toolbar:false">Scala</pre>

<pre class="brush:sql;toolbar:false">Sql</pre>

<pre class="brush:vb;toolbar:false">Vb</pre>

<pre class="brush:xml;toolbar:false">Xml</pre>

以上就是帝国cms编辑器不支持内容页代码语法高亮解决方法,纯绿色,无任何副作用!

帝国cms搜索模板不支持灵动标签...解决方法

下面附上现成的代码,直接覆盖掉/e/search/result/index.php文件就可以。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

<?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> > ".$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);

?>

其实以上代码是在帝国CMS搜索文件的基础上二次修改的,我们一起来看看修改了哪些地方。

1、打开 /e/search/result/index.php 文件

1

2

3

4

5

require("../../class/connect.php");

require("../../class/db_sql.php");

require("../../data/dbcache/class.php");

require("../../class/q_functions.php");

require "../".LoadLang("pub/fun.php");

修改为:

1

2

3

4

5

6

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");

2、再查找

1

2

//替换公共模板变量

$listtemp=$tempr[temptext]; 

在下面添加以下支持标签代码:

1

2

//页面支持标签

$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);

不过以上代码会有一点点小小的bug,就是会出现缓存,大家可以在数据更新-->更新数据库缓存!

 

posted @   ninama  阅读(335)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示