D1V1网社区 @开门芝麻网 吃饭赚钱 睡觉赚钱 做梦赚钱 http://sns.d1v1.com & http://www.KaiMenZhiMa.com/

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 6410|回复: 1

支持php代码的帝国cms搜索页模板

[复制链接]
发表于 2013-12-25 19:54:02 | 显示全部楼层 |阅读模式 <
开门芝麻网
连劲智播AI智能自动播实景无人直播(APP免费注册下载)http://kaimenzhima.com/forum.php?mod=viewthread&tid=1
让帝国cms搜索页模板支持php代码
1.在/e/search/result/index.php头上加入
1

require('../../class/functions.php');

2.在/e/search/result/index.php 120行左右
1

2

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

这行代码之前加上
1

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


完整代码如下:
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

123

124

125

126

127

128

<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../data/dbcache/class.php");
require('../../class/functions.php');
require('../../class/t_functions.php');
include "../".LoadLang("pub/fun.php");
$editor=1;
$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']))
{
printerror("SearchNotRecord",$getfrom,1);
}
$page=(int)$_GET['page'];
$start=0;
$page_line=$public_r['search_pagenum'];//每页显示链接数
$line=$public_r['search_num'];//每页显示记录数
if(!(int)$_GET['line']){
$line=$public_r['search_num'];//每页显示记录数
}else{
$line=(int)$_GET['line'];
$search="&line=".(int)$_GET['line'];
}
$search.="&classid=".(int)$_GET['classid'];
$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]." where checked=1".$add;
$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 tempid,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 tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
}
else
{
$tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");
}
$have_class=1;
  
//页面支持标签(zhuxianfei.com)
$tempr[temptext]=DtNewsBq('list'.$tempr[tempid],$tempr[temptext],0);
//替换公共模板变量
$listtemp=$tempr[temptext];
if($public_r['searchtempvar'])
{
$listtemp=ReplaceTempvar($listtemp);
}
$search_r[keyboard]=htmlspecialchars($search_r[keyboard]);
$listtemp=str_replace("[!--show.page--]",$listpage,$listtemp);
$listtemp=str_replace("",$search_r[keyboard],$listtemp);
$listtemp=str_replace("[!--ecms.num--]",$num,$listtemp);
$url="<a href='".$public_r[newsurl]."'>".$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('/',$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);
?>





开门芝麻网
部分内容由网友发布或收集于互联网,如有侵权,请联系QQ/微信76815288,第一时间删除!(开门芝麻网 sns.d1v1.com)
回复

使用道具 举报

 楼主| 发表于 2013-12-25 19:55:49 | 显示全部楼层 <
<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../data/dbcache/class.php");
require('../../class/functions.php');
require('../../class/t_functions.php');
include "../".LoadLang("pub/fun.php");
$editor=1;
$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']))
{
printerror("SearchNotRecord",$getfrom,1);
}
$page=(int)$_GET['page'];
$start=0;
$page_line=$public_r['search_pagenum'];//每页显示链接数
$line=$public_r['search_num'];//每页显示记录数
if(!(int)$_GET['line']){
$line=$public_r['search_num'];//每页显示记录数
}else{
$line=(int)$_GET['line'];
$search="&line=".(int)$_GET['line'];
}
$search.="&classid=".(int)$_GET['classid'];
$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]." where checked=1".$add;
$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 tempid,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 tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");
}
else
{
$tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$class_r[$search_r[trueclassid]][searchtempid]."' limit 1");
}
$have_class=1;
  
//页面支持标签(zhuxianfei.com)
$tempr[temptext]=DtNewsBq('list'.$tempr[tempid],$tempr[temptext],0);
//替换公共模板变量
$listtemp=$tempr[temptext];
if($public_r['searchtempvar'])
{
$listtemp=ReplaceTempvar($listtemp);
}
$search_r[keyboard]=htmlspecialchars($search_r[keyboard]);
$listtemp=str_replace("[!--show.page--]",$listpage,$listtemp);
$listtemp=str_replace("",$search_r[keyboard],$listtemp);
$listtemp=str_replace("[!--ecms.num--]",$num,$listtemp);
$url="<a href='".$public_r[newsurl]."'>".$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('/',$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);
?>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

 
在线客服
点击这里给我发消息 点击这里给我发消息 点击这里给我发消息 点击这里给我发消息
售前咨询热线
400-888-xxxx

微信扫一扫,私享最新原创实用干货

QQ|申请友链|Archiver|手机版|小黑屋|D1V1网社区 @开门芝麻网 ( 沪ICP备15050032号-2 )

GMT+8, 2024-11-23 21:25 , Processed in 0.182077 second(s), 30 queries .

Powered by Discuz! X3.4 Designed by www.D1V1.cn

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表