帝国CMS搜索页面模板不支持灵动标签和万能标签的方法

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

查找

  1. require("../../class/connect.php");
  2. require("../../class/db_sql.php");
  3. require("../../data/dbcache/class.php");
  4. require("../../class/q_functions.php");
  5. require "../".LoadLang("pub/fun.php");

修改为:

  1. require('../../class/connect.php');
  2. require('../../class/db_sql.php');
  3. require('../../class/functions.php');
  4. require('../../class/t_functions.php');
  5. require('../../data/dbcache/class.php');
  6. require "../".LoadLang("pub/fun.php");

2,再查找

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

在上面添加如下代码

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

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

下边的代码直接覆盖掉/e/search/result/index.php文件就可以。

  1. <?php
  2. require("../../class/connect.php");
  3. require("../../class/db_sql.php");
  4. require("../../data/dbcache/class.php");
  5. require('../../class/functions.php');
  6. require('../../class/t_functions.php');
  7. require "../".LoadLang("pub/fun.php");
  8. $editor=1;
  9. eCheckCloseMods('search');//关闭模块
  10. $link=db_connect();
  11. $empire=new mysqlquery();
  12. $getvar=$_GET['getvar'];
  13. if(empty($getvar))
  14. {
  15. $getfrom="history.go(-1)";
  16. }
  17. else
  18. {
  19. $getfrom="../../../search/";
  20. }
  21. //搜索结果
  22. $searchid=(int)$_GET['searchid'];
  23. if(empty($searchid))
  24. {
  25. printerror("SearchNotRecord",$getfrom,1);
  26. }
  27. $search_r=$empire->fetch1("select searchid,keyboard,result_num,orderby,myorder,tbname,tempid,andsql,trueclassid from {$dbtbpre}enewssearch where searchid='$searchid'");
  28. if(empty($search_r['searchid'])||InfoIsInTable($search_r[tbname]))
  29. {
  30. printerror("SearchNotRecord",$getfrom,1);
  31. }
  32. $page=(int)$_GET['page'];
  33. $page=RepPIntvar($page);
  34. $start=0;
  35. $page_line=$public_r['search_pagenum'];//每页显示链接数
  36. $line=$public_r['search_num'];//每页显示记录数
  37. $offset=$page*$line;//总偏移量
  38. $search="&searchid=".$searchid;
  39. $myorder=$search_r[orderby];
  40. if(empty($search_r[myorder]))
  41. {
  42. $myorder.=" desc";
  43. }
  44. $add=stripSlashes($search_r['andsql']);
  45. $num=$search_r[result_num];
  46. $query="select * from {$dbtbpre}ecms_".$search_r[tbname].($add?' where '.substr($add,5):'');
  47. $query.=" order by ".$myorder." limit $offset,$line";
  48. $sql=$empire->query($query);
  49. $listpage=page1($num,$line,$page_line,$start,$page,$search);
  50. //取得模板
  51. if($search_r['tempid'])
  52. {
  53. $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where tempid='".$search_r['tempid']."' limit 1");
  54. }
  55. elseif(empty($class_r[$search_r[trueclassid]][searchtempid]))
  56. {
  57. $tempr=$empire->fetch1("select temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewssearchtemp")." where isdefault=1 limit 1");

    帝国CMS搜索页面模板不支持灵动标签和万能标签的方法

扫一扫手机访问