帝国CMS自定义栏目伪静态插件{SEO栏目优化利器}

元之本网站建设2019-08-20 10:16:3817670

帝国CMS自定义栏目伪静态插件{SEO栏目优化利器}[支持7.0,7.2]
本文关键字词:自定义伪静态,栏目目录伪静态,内容目录伪静态,帝国cms伪静态,SEO栏目优化

实现栏目目录伪静态,比如news/china/69_1.html 是伪静态实现的,而不是生成静态的。纯绿色不影响帝国原有伪静态、静态和动态等功能设置。

1:栏目要选静态 不生成
2:内容页存放目录--栏目目录,内容页目录存放形式--不设置目录,(有利SEO,方便匹配栏目ID)
3:内容页文件命名形式 不能是目录,但是支持信息文件名的修改,URL也能很好看
4:栏目目录和信息文件名是英文或数字(栏目目录建议英文或英文开头,“-_”上下划线留着给别的东西用吧避免冲突如其它伪静态,避免冲突)
********为了通用只能遵守上述要求,有这些特殊需求自己改去*********

栏目设置截图演示:
帝国CMS自定义栏目伪静态插件{SEO栏目优化利器} 第1张 

伪静态规则:

  1. #栏目

  2. RewriteCond %{QUERY_STRING} ^(.*)$

  3. RewriteCond %{REQUEST_FILENAME} !-f

  4. RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/)

  5. RewriteRule ^([0-9a-zA-Z/]+)/(|index\.html|index_[0-9]+\.html)$ /e/action/list\.php\?classid=$1&page=$2

  6. #内容

  7. RewriteCond %{QUERY_STRING} ^(.*)$

  8. RewriteCond %{REQUEST_FILENAME} !-f

  9. RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/)

  10. RewriteRule ^([0-9a-zA-Z/]+)/([0-9a-zA-Z]+)([_0-9]*)\.html$ /e/action/show\.php\?classid=$1&id=$2&page=$3

复制代码


在/e/action/下增加如下php文件:
列表list.php代码:

  1. <?php

  2. require('../class/connect.php');

  3. require('../class/db_sql.php');

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

  5. require('../class/t_functions.php');

  6. require('../data/dbcache/class.php');

  7. require LoadLang('pub/fun.php');

  8. $link=db_connect();

  9. $empire=new mysqlquery();

  10. $editor=1;

  11. $classid=RepPostStr($_GET['classid']);//修改过滤方式--yognlan

  12. //获取真实classid--yognlan

  13. if(!is_numeric($classid)){

  14.     foreach ($class_r as $val){

  15.         foreach ($val as $val2){

  16.             if($classid==$val['classpath']){

  17.                 $classid=$val['classid'];

  18.                 break;

  19.             }

  20.         }

  21.     }

  22. }

  23. if(empty($classid))

  24. {

  25.         printerror("ErrorUrl","history.go(-1)",1);

  26. }

  27. $search='&classid='.$classid;

  28. $tbname=$class_r[$classid][tbname];

  29. $mid=$class_r[$classid][modid];

  30. if(empty($tbname)||empty($mid)||InfoIsInTable($tbname))

  31. {

  32.         printerror("ErrorUrl","history.go(-1)",1);

  33. }

  34. $cr=$empire->fetch1("select classid,classpagekey,intro,classimg,cgroupid,islist,classtempid,listdt,bdinfoid,repagenum,islast,infos from {$dbtbpre}enewsclass where classid='$classid'");

  35. if(empty($cr['classid']))

  36. {

  37.         printerror("ErrorUrl","history.go(-1)",1);

  38. }

  39. if($class_r[$classid][islast]&&$cr['bdinfoid'])

  40. {

  41.         printerror("ErrorUrl","history.go(-1)",1);

  42. }

  43. //是否支持动态页

  44. /*伪静态不需要

  45. if(empty($class_r[$classid]['listdt'])&&!$cr['repagenum'])

  46. {

  47.         $classurl=sys_ReturnBqClassname($cr,9);

  48.         Header("Location:$classurl");

  49.         exit();

  50. }

  51. */

  52. //权限

  53. if($cr['cgroupid'])

  54. {

  55.         $mgroupid=(int)getcvar('mlgroupid');

  56.         if(!strstr($cr[cgroupid],','.$mgroupid.','))

  57.         {

  58.                 printerror('NotLevelToClass','history.go(-1)',1);

  59.         }

  60. }

  61. $GLOBALS['navclassid']=$classid;

  62. $url=ReturnClassLink($classid);

  63. $pagetitle=$class_r[$classid]['classname'];

  64. $pagekey=$cr['classpagekey'];

  65. $pagedes=$cr['intro'];

  66. $classimg=$cr['classimg']?$cr['classimg']:$public_r[newsurl].'e/data/images/notimg.gif';

  67. //---封面式---

  68. if(!$class_r[$classid][islast]&&$cr['islist']!=1)

  69. {

  70.     /*伪静态不需要 ---yonglan

  71.         if(empty($cr['listdt'])||$cr['islist']==3)

  72.         {

  73.                 printerror("ErrorUrl","history.go(-1)",1);

  74.         }

  75.     */

  76.         if($cr[islist]==2)

  77.         {

  78.                 $classtemp=GetClassText($classid);

  79.                 $dttempname='classpage'.$classid;

  80.         }

  81.         else

  82.         {

  83.                 if(empty($cr['classtempid']))

  84.                 {

  85.                         printerror('ErrorUrl','',1);

  86.                 }

  87.                 $classtemp=GetClassTemp($cr['classtempid']);

  88.                 $dttempname='classtemp'.$cr['classtempid'];

  89.         }

  90.         $string=DtNewsBq($dttempname,$classtemp,0);

  91.         $string=str_replace('[!--newsnav--]',$url,$string);//位置导航

  92.         $string=Class_ReplaceSvars($string,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$addr,0);

  93.         $string=str_replace('[!--page.stats--]','',$string);

  94.         echo stripSlashes($string);

  95.         exit();

  96. }

  97. //---列表式---

  98. $add='';

  99. //栏目

  100. if($class_r[$classid][islast])//***栏目

  101. {

  102.         $add.="classid='$classid'";

  103.         $have_class=0;

  104. }

  105. else

  106. {

  107.         $add.=ReturnClass($class_r[$classid][sonclass]);

  108.         $have_class=1;

  109. }

  110. //排序

  111. if(empty($class_r[$classid][reorder]))

  112. {

  113.         $addorder="newstime desc";

  114. }

  115. else

  116. {

  117.         $addorder=$class_r[$classid][reorder];

  118. }

  119. //列表模板

  120. $tempid=$class_r[$classid]['dtlisttempid']?$class_r[$classid]['dtlisttempid']:$class_r[$classid]['listtempid'];

  121. if(empty($tempid))

  122. {

  123.         printerror('ErrorUrl','',1);

  124. }

  125. $tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewslisttemp")." where tempid='$tempid'");

  126. if(empty($tempr[tempid]))

  127. {

  128.         printerror('ErrorUrl','',1);

  129. }

  130. $page=(int)substr($_GET['page'],6);//page是带index-所以去掉----yonglan

  131. $page=RepPIntvar($page)?RepPIntvar($page):1;

  132. $start=0;

  133. $line=$class_r[$classid]['lencord'];//每页显示记录数

  134. $page_line=10;//每页显示链接数

  135. $offset=$page*$line-$line;//总偏移量

  136. //系统模型

  137. $ret_r=ReturnReplaceListF($mid);

  138. //优化

  139. $yhadd='';

  140. $yhid=$class_r[$classid][yhid];

  141. $yhvar='qlist';

  142. if($yhid)

  143. {

  144.         $yhadd=ReturnYhSql($yhid,$yhvar,1);

  145. }

  146. //总数

  147. $totalnum=(int)$_GET['totalnum'];

  148. if($totalnum<1)

  149. {

  150.         if($yhadd)

  151.         {

  152.                 $totalquery="select count(*) as total from {$dbtbpre}ecms_".$tbname." where ".$yhadd.$add;

  153.                 $num=$empire->gettotal($totalquery);

  154.         }

  155.         else

  156.         {

  157.                 $num=ReturnClassInfoNum($cr,0);

  158.         }

  159. }

  160. else

  161. {

  162.         $num=$totalnum;

  163. }

  164. $search.='&totalnum='.$num;

  165. $query="select ".ReturnSqlListF($mid)." from {$dbtbpre}ecms_".$tbname." where ".$yhadd.$add;

  166. $query.=" order by ".ReturnSetTopSql('list').$addorder." limit $offset,$line";

  167. $sql=$empire->query($query);

  168. //伪静态

  169. $pagefunr=eReturnRewriteClassUrl($classid,0);

  170. $pagefunr['repagenum']=$cr['repagenum'];

  171. $pagefunr['dolink']=empty($class_r[$classid]['classurl'])?$public_r['newsurl'].$class_r[$classid]['classpath'].'/':$class_r[$classid]['classurl'].'/';

  172. $pagefunr['dofile']='index';

  173. $pagefunr['dotype']=$class_r[$classid]['classtype'];

  174. //分页

  175. /*不用默认分页了---yonglan

  176. if($pagefunr['rewrite']==1||$pagefunr['repagenum'])

  177. {

  178.         $listpage=InfoUsePage($num,$line,$page_line,$start,$page,$search,$pagefunr);

  179. }

  180. else

  181. {

  182.         $listpage=page1($num,$line,$page_line,$start,$page,$search);

  183. }

  184. */

  185. $listpage=yl_pagelist($num,$line,$page_line,$start,$page);//自己加的分页---yonglan

  186. function yl_pagelist($num,$line,$page_line,$start,$page){//自己加的分页函数---yonglan

  187.     global $fun_r;

  188.         if($num<=$line)

  189.         {

  190.                 return '';

  191.         }

  192.         $f='_';//伪静态分页分割符号

  193.         $url=preg_replace('/_[0-9]+/', '', $_SERVER['HTTP_X_REWRITE_URL']?$_SERVER['HTTP_X_REWRITE_URL']:$_SERVER['REQUEST_URI']);

  194.          if(!strripos($url,'.')){

  195.             $url=$url.'index.html';

  196.          }

  197.         $urlarr=explode('.', $url);

  198.         $snum=3;//最小页数

  199.         $totalpage=ceil($num/$line);//取得总页数

  200.         $firststr='<a title="'.$fun_r['trecord'].'">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';

  201.         //上一页

  202.         if($page<>0)

  203.         {

  204.                 $toppage='<a href="'.substr($urlarr[0],0,-5).'">'.$fun_r['startpage'].'</a>&nbsp;';

  205.                 $pagepr=$page-1;

  206.                                         if($pagepr==1){

  207.                                             $prepage='<a href="'.substr($urlarr[0],0,-5).'">'.$fun_r['pripage'].'</a>&nbsp;';

  208.                                         }else{

  209.                                             $prepage='<a href="'.$urlarr[0].$f.$pagepr.'.'.$urlarr[1].'">'.$fun_r['pripage'].'</a>';

  210.                                         }

  211.                 

  212.         }

  213.         //下一页

  214.         if($page!=$totalpage)

  215.         {

  216.                 $pagenex=$page+1;

  217.                 $nextpage='&nbsp;<a href="'.$urlarr[0].$f.$pagenex.'.'.$urlarr[1].'">'.$fun_r['nextpage'].'</a>';

  218.                 $lastpage='&nbsp;<a href="'.$urlarr[0].$f.$totalpage.'.'.$urlarr[1].'">'.$fun_r['lastpage'].'</a>';

  219.         }

  220.         $starti=$page-$snum<0?0:$page-$snum;

  221.                      $no=0;

  222.         for($i=$starti+1;$i<$totalpage+1&&$no<$page_line;$i++)

  223.         {

  224.                       $no++;

  225.                                             if($page==$i)

  226.                                                 {

  227.                                                         $is_1="<b>";

  228.                                                         $is_2="</b>";

  229.                                                 }

  230.                                                 else

  231.                                                 {

  232.                                                     if($i==1){//***页不加page0

  233.                                             $is_1='<a href="'.substr($urlarr[0],0,-5).'">';

  234.                                             $is_2="</a>";

  235.                                         }else{

  236.                                                $is_1='<a href="'.$urlarr[0].$f.$i.'.'.$urlarr[1].'">';

  237.                                                         $is_2="</a>";

  238.                                         }

  239.                                                      

  240.                                                 }

  241.     

  242.                 

  243.                 $pagenum=$i;

  244.                 $returnstr.="&nbsp;".$is_1.$pagenum.$is_2;

  245.         }

  246.         $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;

  247.         return $returnstr;

  248. }//自己写的分页函数结束-----yonglannet

  249. //页面支持标签

  250. if($public_r['dtcanbq'])

  251. {

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

  253. }

  254. else

  255. {

  256.         if($public_r['searchtempvar'])

  257.         {

  258.                 $tempr[temptext]=ReplaceTempvar($tempr[temptext]);

  259.         }

  260. }

  261. $listtemp=$tempr[temptext];

  262. $rownum=$tempr[rownum];

  263. if(empty($rownum))

  264. {$rownum=1;}

  265. $formatdate=$tempr[showdate];

  266. $subnews=$tempr[subnews];

  267. $subtitle=$tempr[subtitle];

  268. $docode=$tempr[docode];

  269. $modid=$tempr[modid];

  270. $listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]);

  271. //公共

  272. $listtemp=str_replace('[!--newsnav--]',$url,$listtemp);//位置导航

  273. $listtemp=Class_ReplaceSvars($listtemp,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$addr,0);

  274. $listtemp=str_replace('[!--page.stats--]','',$listtemp);

  275. $listtemp=str_replace('[!--show.page--]',$listpage,$listtemp);

  276. $listtemp=str_replace('[!--show.listpage--]',$listpage,$listtemp);

  277. $listtemp=str_replace('[!--list.pageno--]',$page+1,$listtemp);

  278. //取得列表模板

  279. $list_exp="[!--empirenews.listtemp--]";

  280. $list_r=explode($list_exp,$listtemp);

  281. $listtext=$list_r[1];

  282. $no=$offset+1;

  283. $changerow=1;

  284. while($r=$empire->fetch($sql))

  285. {

  286.         //替换列表变量

  287.         $repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode);

  288.         $listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);

  289.         $changerow+=1;

  290.         //超过行数

  291.         if($changerow>$rownum)

  292.         {

  293.                 $changerow=1;

  294.                 $string.=$listtext;

  295.                 $listtext=$list_r[1];

  296.         }

  297.         $no++;

  298. }

  299. //多余数据

  300. if($changerow<=$rownum&&$listtext<>$list_r[1])

  301. {

  302.         $string.=$listtext;

  303. }

  304. $string=$list_r[0].$string.$list_r[2];

  305. echo stripSlashes($string);

  306. db_close();

  307. $empire=null;

  308. ?>

复制代码


内容show.php代码:

  1. <?php

  2. require('../class/connect.php');

  3. require('../class/db_sql.php');

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

  5. require('../class/t_functions.php');

  6. require LoadLang('pub/fun.php');

  7. require('../data/dbcache/class.php');

  8. require('../data/dbcache/MemberLevel.php');

  9. $link=db_connect();

  10. $empire=new mysqlquery();

  11. $classid=RepPostStr($_GET['classid']);//修改过滤方式--yognlan

  12. $id=RepPostStr($_GET['id']);//修改过滤方式--yognlan

  13. //获取真实classid--yognlan

  14. if(!is_numeric($classid)){

  15.     foreach ($class_r as $val){

  16.         foreach ($val as $val2){

  17.             if($classid==$val['classpath']){

  18.                 $classid=$val['classid'];

  19.                 break;

  20.             }

  21.         }

  22.     }

  23. }

  24. //获取真实信息id--yognlan

  25. if(is_numeric($id) && !$class_r[$classid]['filename']){

  26.     $where="classid='$classid' and id='$id'";

  27. }else{

  28.     $where="classid='$classid' and filename='$id'";

  29. }

  30. $page=(int)substr($_GET['page'],1);//page是带横线所以去掉----yonglan

  31. $page=RepPIntvar($page)?RepPIntvar($page):1;

  32. $mid=$class_r[$classid]['modid'];

  33. $tbname=$class_r[$classid]['tbname'];

  34. //验证IP

  35. eCheckAccessDoIp('showinfo');

  36. if(!$classid||!$id||!$mid||!$tbname||InfoIsInTable($tbname))

  37. {

  38.         printerror('此信息不存在','',1,0,1);

  39. }

  40. $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where $where limit 1");

  41. if(!$r['id']||$classid!=$r['classid'])

  42. {

  43.         printerror('此信息不存在','',1,0,1);

  44. }

  45. $id=$r['id'];//ID重新赋值--yognlan

  46. //外部链接

  47. if($r['isurl'])

  48. {

  49.         $titleurl=$r['titleurl'];

  50.         Header("Location:$titleurl");

  51.         exit();

  52. }

  53. //是否支持动态内容页

  54. /*伪静态不需要--yonglannet

  55. if($class_r[$classid]['showdt']!=2)

  56. {

  57.         $titleurl=sys_ReturnBqTitleLink($r);

  58.         Header("Location:$titleurl");

  59.         exit();

  60. }

  61. */

  62. //副表

  63. $finfor=$empire->fetch1("select ".ReturnSqlFtextF($mid)." from {$dbtbpre}ecms_".$tbname."_data_".$r['stb']." where id='$r[id]' limit 1");

  64. $r=array_merge($r,$finfor);

  65. //权限

  66. if($r['groupid']||$class_r[$classid]['cgtoinfo'])

  67. {

  68.         define('empirecms','wm_chief');

  69.         define('PageCheckLevel','wm_chief');

  70.         $check_tbname=$tbname;

  71.         $check_infoid=$id;

  72.         $check_classid=$classid;

  73.         $check_path="../../";

  74.         $checkinfor=$r;

  75.         @include("../class/CheckLevel.php");

  76. }

  77. //存文本

  78. if($emod_r[$mid]['savetxtf'])

  79. {

  80.         $stf=$emod_r[$mid]['savetxtf'];

  81.         if($r[$stf])

  82.         {

  83.                 $r[$stf]=GetTxtFieldText($r[$stf]);

  84.         }

  85. }

  86. //初始值

  87. $search="&classid=$classid&id=$id";

  88. $line=1;

  89. $start=0;

  90. $page_line=6;//每页显示链接数

  91. $offset=$page*$line-$line;//总偏移量

  92. $GLOBALS['navclassid']=$r[classid];

  93. $GLOBALS['navinfor']=$r;

  94. //取得内容模板

  95. $r[newstempid]=$r[newstempid]?$r[newstempid]:$class_r[$r[classid]][newstempid];

  96. $newstemp_r=$empire->fetch1("select tempid,temptext,showdate from ".GetTemptb("enewsnewstemp")." where tempid='$r[newstempid]'");


  97. //替换模板变量

  98. function DtGetHtml($add,$newstemp_r,$mid,$tbname,$line,$page_line,$start,$page,$search){

  99.         global $public_r,$class_r,$class_zr,$class_tr,$fun_r,$empire,$dbtbpre,$emod_r,$level_r;

  100.         //更新点击

  101.         $empire->query("update {$dbtbpre}ecms_".$tbname." set onclick=onclick+1 where id='$add[id]' limit 1");

  102.         $add['onclick']=$add['onclick']+1;

  103.         //模板参数

  104.         $newstemptext=$newstemp_r[temptext];

  105.         $formatdate=$newstemp_r[showdate];

  106.         //页面

  107.         $pagetitle=ehtmlspecialchars($add[title]);

  108.         $url=ReturnClassLink($add[classid]);//导航

  109.         $newstemptext=DtInfo_ReplaceSvars($newstemptext,$url,$add[classid],$pagetitle,$add[keyboard],$pagetitle);

  110.         //相关信息

  111.         if(strstr($newstemptext,'[!--other.link--]'))

  112.         {

  113.             $keyboardtext=GetKeyboard($add[keyboard],$add[keyid],$add[classid],$add[id],$class_r[$add[classid]][link_num]);

  114.         }

  115.         //分页字段

  116.         $ptitle=$add['title'];

  117.         $truepage='';

  118.         $titleselect='';

  119.         $expage='[!--empirenews.page--]';//分页符

  120.         $pf=$emod_r[$mid]['pagef'];

  121.         if($pf&&strstr($add[$pf],$expage))//有分页

  122.         {

  123.                 $n_r=explode($expage,$add[$pf]);

  124.                 $thispagenum=count($n_r);

  125.                 if($page<0||$page>$thispagenum)

  126.                 {

  127.                         $page=1;

  128.                 }

  129.                 $add[$pf]=$n_r[$page-1];

  130.                 if($page)

  131.                 {

  132.                         $ti_r=explode('[/!--empirenews.page--]',$n_r[$page]);

  133.                         if(count($ti_r)>=2)

  134.                         {

  135.                                 $ptitle=$ti_r[0];

  136.                                 $add[$pf]=$ti_r[1];

  137.                         }

  138.                         else

  139.                         {

  140.                                 $ptitle=$add['title'].'('.($page-1).')';

  141.                         }

  142.                 }

  143.                 //伪静态

  144.                 $pagefunr=eReturnRewriteInfoUrl($add['classid'],$add['id'],0);

  145.                 $pagefunr['repagenum']=0;

  146.                 //取得分页

  147.                 //屏蔽---yonglan $truepage=InfoUsePage($thispagenum,$line,$page_line,$start,$page,$search,$pagefunr);

  148.                 //自己写的伪静态分页---yonglan

  149.      //前台分页

  150. function yl_showpage($num,$line,$page_line,$start,$page){

  151.         global $fun_r;

  152.         if($num<=$line)

  153.         {

  154.                 return '';

  155.         }

  156.         $f='_';//伪静态分页分割符号

  157.         $url=preg_replace('/_[0-9]+/', '', $_SERVER['HTTP_X_REWRITE_URL']?$_SERVER['HTTP_X_REWRITE_URL']:$_SERVER['REQUEST_URI']);

  158.         $urlarr=explode('.', $url);

  159.         $snum=3;//最小页数

  160.         $totalpage=ceil($num/$line);//取得总页数

  161.         $firststr='<a title="'.$fun_r['trecord'].'">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';

  162.         //上一页

  163.         if($page>1)

  164.         {

  165.                 $toppage='<a href="'.$url.'">'.$fun_r['startpage'].'</a>&nbsp;';

  166.                 $pagepr=$page-1;

  167.                                         if($pagepr==1){

  168.                                             $prepage='<a href="'.$url.'">'.$fun_r['pripage'].'</a>&nbsp;';

  169.                                         }else{

  170.                                             $prepage='<a href="'.$urlarr[0].$f.$pagepr.'.'.$urlarr[1].'">'.$fun_r['pripage'].'</a>';

  171.                                         }

  172.                 

  173.         }

  174.         //下一页


  175.         if($page!=$totalpage)

  176.         {

  177.                 $pagenex=$page+1;

  178.                 $nextpage='&nbsp;<a href="'.$urlarr[0].$f.$pagenex.'.'.$urlarr[1].'">'.$fun_r['nextpage'].'</a>';

  179.                 $lastpage='&nbsp;<a href="'.$urlarr[0].$f.($totalpage).'.'.$urlarr[1].'">'.$fun_r['lastpage'].'</a>';

  180.         }

  181.         $starti=$page-$snum<0?0:$page-$snum;

  182.         $no=0;

  183.         for($i=$starti+1;$i<$totalpage+1&&$no<$page_line;$i++)

  184.         {

  185.                 $no++;

  186.                                             if($page==$i)

  187.                                                 {

  188.                                                         $is_1="<b>";

  189.                                                         $is_2="</b>";

  190.                                                 }

  191.                                                 else

  192.                                                 {

  193.                                                     if($i==1){//***页不加page0

  194.                                             $is_1='<a href="'.$url.'">';

  195.                                             $is_2="</a>";

  196.                                         }else{

  197.                                                $is_1='<a href="'.$urlarr[0].$f.$i.'.'.$urlarr[1].'">';

  198.                                                         $is_2="</a>";

  199.                                         }

  200.                                                      

  201.                                                 }

  202.     

  203.                 

  204.                 $pagenum=$i;

  205.                 $returnstr.="&nbsp;".$is_1.$pagenum.$is_2;

  206.         }

  207.         $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;

  208.         return $returnstr;

  209. }

  210.      $truepage=yl_showpage($thispagenum,$line,$page_line,$start,$page);//伪静态分页            

  211. //自己写的伪静态分页结束----yonglan

  212.                 //下拉式分页

  213.                 if(strstr($newstemptext,'[!--title.select--]'))

  214.                 {

  215.                         for($j=0;$j<$thispagenum;$j++)

  216.                         {

  217.                                 $spurl=eReturnRewritePageLink($pagefunr,$j);

  218.                                 if($j==0)

  219.                                 {

  220.                                         $sptitle=$add[title];

  221.                                 }

  222.                                 else

  223.                                 {

  224.                                         $ti_r=explode('[/!--empirenews.page--]',$n_r[$j]);

  225.                                         $sptitle=count($ti_r)>=2?$ti_r[0]:$add[title].'('.($j+1).')';

  226.                                 }

  227.                                 $select='';

  228.                                 if($page==$j)

  229.                                 {

  230.                                         $ptitle=$sptitle;

  231.                                         $select=' selected';

  232.                                 }

  233.                                 $titleselect.='<option value="'.$spurl.'"'.$select.'>'.$sptitle.'</option>';

  234.                         }

  235.                         $titleselect='<select name="titleselect" onchange="self.location.href=this.options[this.selectedIndex].value">'.$titleselect.'</select>';

  236.                 }

  237.                 //下一页链接

  238.                 if($page==$thispagenum-1)

  239.                 {

  240.                         $thisnextlink=eReturnRewritePageLink($pagefunr,0);

  241.                 }

  242.                 else

  243.                 {

  244.                         $thisnextlink=eReturnRewritePageLink($pagefunr,$page+1);

  245.                 }

  246.         }

  247.         //返回替换验证字符

  248.         $docheckrep=ReturnCheckDoRepStr();

  249.         if($add[newstext])

  250.         {

  251.                 if(empty($public_r['dorepword'])&&$docheckrep[3])

  252.                 {

  253.                         $add[newstext]=ReplaceWord($add[newstext]);//过滤字符

  254.                 }

  255.                 if(empty($public_r['dorepkey'])&&$docheckrep[4]&&!empty($add[dokey]))//替换关键字

  256.                 {

  257.                         $add[newstext]=ReplaceKey($add['newstext'],$add['classid']);

  258.                 }

  259.                 if($public_r['opencopytext'])

  260.                 {

  261.                         $add[newstext]=AddNotCopyRndStr($add[newstext]);//随机复制字符

  262.                 }

  263.         }

  264.         //变量

  265.         $tempf=$emod_r[$mid]['tempf'];

  266.         $fr=explode(',',$tempf);

  267.         $fcount=count($fr)-1;

  268.         //变量替换

  269.         $newstempstr=$newstemptext;//模板

  270.         for($i=1;$i<$fcount;$i++)

  271.         {

  272.                 $f=$fr[$i];

  273.                 $value=$add[$f];

  274.                 if($f=='downpath')//下载地址

  275.                 {

  276.                         if(strstr($newstemptext,'[!--downpath--]'))

  277.                         {

  278.                                 $value=ReturnDownSoftHtml($add);

  279.                         }

  280.                 }

  281.                 elseif($f=='onlinepath')//观看地址

  282.                 {

  283.                         if(strstr($newstemptext,'[!--onlinepath--]'))

  284.                         {

  285.                                 $value=ReturnOnlinepathHtml($add);

  286.                         }

  287.                 }

  288.                 elseif($f=='morepic')//图片集

  289.                 {

  290.                         if(strstr($newstemptext,'[!--morepic--]'))

  291.                         {

  292.                                 $value=ReturnMorepicpathHtml($add);

  293.                         }

  294.                 }

  295.                 elseif($f=='newstime')//时间

  296.                 {

  297.                         if(strstr($newstemptext,'[!--newstime--]'))

  298.                         {

  299.                                 $value=date($formatdate,$value);

  300.                         }

  301.                 }

  302.                 elseif($f=='befrom')//信息来源

  303.                 {

  304.                         if($docheckrep[1]&&strstr($newstemptext,'[!--befrom--]'))

  305.                         {

  306.                                 $value=ReplaceBefrom($value);

  307.                         }

  308.                 }

  309.                 elseif($f=='writer')//作者

  310.                 {

  311.                         if($docheckrep[2]&&strstr($newstemptext,'[!--writer--]'))

  312.                         {

  313.                                 $value=ReplaceWriter($value);

  314.                         }

  315.                 }

  316.                 elseif($f=='titlepic')//标题图片

  317.                 {

  318.                         if(empty($value))

  319.                         {$value=$public_r[newsurl].'e/data/images/notimg.gif';}

  320.                 }

  321.                 elseif($f=='title')//标题

  322.                 {

  323.                 }

  324.                 else//正常字段

  325.                 {

  326.                         if(!strstr($emod_r[$mid]['editorf'],','.$f.','))

  327.                         {

  328.                                 if(strstr($emod_r[$mid]['tobrf'],','.$f.','))//加br

  329.                                 {

  330.                                         $value=nl2br($value);

  331.                                 }

  332.                                 if(!strstr($emod_r[$mid]['dohtmlf'],','.$f.','))//去除html

  333.                                 {

  334.                                         $value=RepFieldtextNbsp(ehtmlspecialchars($value));

  335.                                 }

  336.                         }

  337.                 }

  338.                 $newstempstr=str_replace('[!--'.$f.'--]',$value,$newstempstr);

  339.         }

  340.         //固定变量

  341.         $newstempstr=str_replace('[!--id--]',$add[id],$newstempstr);

  342.         $newstempstr=str_replace('[!--classid--]',$add[classid],$newstempstr);

  343.         $newstempstr=str_replace('[!--class.name--]',$class_r[$add[classid]][classname],$newstempstr);

  344.         $newstempstr=str_replace('[!--ttid--]',$add[ttid],$newstempstr);

  345.         $newstempstr=str_replace('[!--tt.name--]',$class_tr[$add[ttid]][tname],$newstempstr);

  346.         $newstempstr=str_replace('[!--onclick--]',$add[onclick],$newstempstr);

  347.         $newstempstr=str_replace('[!--userfen--]',$add[userfen],$newstempstr);

  348.         $newstempstr=str_replace('[!--username--]',$add[username],$newstempstr);

  349.         //带链接的用户名

  350.         if($add[ismember]==1&&$add[userid])

  351.         {

  352.                 $newstempstr=str_replace('[!--linkusername--]',"<a href='".$public_r[newsurl]."e/space/?userid=".$add[userid]."' target=_blank>".$add[username]."</a>",$newstempstr);

  353.         }

  354.         else

  355.         {

  356.                 $newstempstr=str_replace('[!--linkusername--]',$add[username],$newstempstr);

  357.         }

  358.         $newstempstr=str_replace('[!--userid--]',$add[userid],$newstempstr);

  359.         $newstempstr=str_replace('[!--other.link--]',$keyboardtext,$newstempstr);

  360.         $newstempstr=str_replace('[!--news.url--]',$public_r[newsurl],$newstempstr);

  361.         $newstempstr=str_replace('[!--plnum--]',$add[plnum],$newstempstr);

  362.         $newstempstr=str_replace('[!--totaldown--]',$add[totaldown],$newstempstr);

  363.         $newstempstr=str_replace('[!--keyboard--]',$add[keyboard],$newstempstr);

  364.         //链接

  365.         $titleurl=sys_ReturnBqTitleLink($add);

  366.         $newstempstr=str_replace('[!--titleurl--]',$titleurl,$newstempstr);

  367.         $newstempstr=str_replace('[!--page.stats--]','',$newstempstr);

  368.         $classurl=sys_ReturnBqClassname($add,9);

  369.         $newstempstr=str_replace('[!--class.url--]',$classurl,$newstempstr);

  370.         //下一篇

  371.         if(strstr($newstemptext,'[!--info.next--]'))

  372.         {

  373.                 $next_r=$empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id>$add[id] and classid='$add[classid]' order by id limit 1");

  374.                 if(empty($next_r[id]))

  375.                 {

  376.                         $infonext="<a href='".$classurl."'>".$fun_r['HaveNoNextLink']."</a>";

  377.                 }

  378.                 else

  379.                 {

  380.                         //链接

  381.                         $nexttitleurl=sys_ReturnBqTitleLink($next_r);

  382.                         $infonext="<a href='".$nexttitleurl."'>".$next_r[title]."</a>";

  383.                 }

  384.                 $newstempstr=str_replace('[!--info.next--]',$infonext,$newstempstr);

  385.         }

  386.         //上一篇

  387.         if(strstr($newstemptext,'[!--info.pre--]'))

  388.         {

  389.                 $next_r=$empire->fetch1("select isurl,titleurl,classid,id,title from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id<$add[id] and classid='$add[classid]' order by id desc limit 1");

  390.                 if(empty($next_r[id]))

  391.                 {

  392.                         $infonext="<a href='".$classurl."'>".$fun_r['HaveNoNextLink']."</a>";

  393.                 }

  394.                 else

  395.                 {

  396.                         //链接

  397.                         $nexttitleurl=sys_ReturnBqTitleLink($next_r);

  398.                         $infonext="<a href='".$nexttitleurl."'>".$next_r[title]."</a>";

  399.                 }

  400.                 $newstempstr=str_replace('[!--info.pre--]',$infonext,$newstempstr);

  401.         }

  402.         //投票

  403.         if(strstr($newstemptext,'[!--info.vote--]'))

  404.         {

  405.                 $myvotetext=sys_GetInfoVote($add[classid],$add[id]);

  406.                 $newstempstr=str_replace('[!--info.vote--]',$myvotetext,$newstempstr);

  407.         }

  408.         //评分

  409.         if(strstr($newstemptext,'[!--pinfopfen--]'))

  410.         {

  411.                 $pinfopfen=$add[infopfennum]?round($add[infopfen]/$add[infopfennum]):0;

  412.                 $newstempstr=str_replace('[!--pinfopfen--]',$pinfopfen,$newstempstr);

  413.                 $newstempstr=str_replace('[!--infopfennum--]',$add[infopfennum],$newstempstr);

  414.         }

  415.         $string=$newstempstr;

  416.         //替换变量

  417.         $string=str_replace('[!--p.title--]',strip_tags($ptitle),$string);

  418.         $string=str_replace('[!--next.page--]',$thisnextlink,$string);

  419.         $string=str_replace('[!--page.url--]',$truepage,$string);

  420.         $string=str_replace('[!--title.select--]',$titleselect,$string);

  421.         return $string;

  422. }


  423. if(empty($newstemp_r['tempid']))

  424. {

  425.         printerror('ErrorUrl','',1);

  426. }

  427. //页面支持标签

  428. if($public_r['dtncanbq'])

  429. {

  430.         $newstemp_r[temptext]=DtNewsBq('text'.$newstemp_r[tempid],$newstemp_r[temptext],1);

  431. }

  432. else

  433. {

  434.         if($public_r['searchtempvar'])

  435.         {

  436.                 $newstemp_r[temptext]=ReplaceTempvar($newstemp_r[temptext]);

  437.         }

  438. }

  439. $string=DtGetHtml($r,$newstemp_r,$mid,$tbname,$line,$page_line,$start,$page,$search);

  440. echo stripSlashes($string);

  441. db_close();

  442. $empire=null;

  443. ?>

复制代码


2015/02/03 修复IIS下分页错误代码:
下载附件覆盖即可。
手动修改方法:找到分页处list.php 139行左右 show.php158行左右,$url修改为:

  1. $url=preg_replace('/_[0-9]+/', '', $_SERVER['HTTP_X_REWRITE_URL']?$_SERVER['HTTP_X_REWRITE_URL']:$_SERVER['REQUEST_URI']);

复制代码

即可插件下载地址:https://pan.baidu.com/s/1icOCcX8QO2SFtZKsxrq5xw

打赏支付宝打赏微信打赏

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

本文链接:http://www.yuyubebe.cn/2019/08/284/

发表评论

评论列表(0人评论 , 1767人围观)
☹还没有评论,来说两句吧...
«    2023年4月    »
12
3456789
10111213141516
17181920212223
24252627282930
宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取