最新公告
欢迎您光临零氪源码,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!欢迎加入VIP

帝国CMS同一条信息使用不同的多个内容页模板伪静态实现教程

正文概述 零氪   2024-12-22  
';//分页符 $pf=$emod_r[$mid]['pagef']; if($pf&&strstr($add[$pf],$expage))//有分页 { $n_r=explode($expage,$add[$pf]); $thispagenum=count($n_r); //checkpageno eCheckListPageNo($page,$line,$thispagenum); if($page<0||$page>$thispagenum-1) { $page=0; } $add[$pf]=$n_r[$page]; if($page) { $ti_r=explode('[/!--empirenews.page--]',$n_r[$page]); if(count($ti_r)>=2) { $ptitle=$ti_r[0]; $add[$pf]=$ti_r[1]; } else { $ptitle=$add['title'].'('.($page+1).')'; } } //伪静态 $pagefunr=eReturnRewriteInfoUrl($add['classid'],$add['id'],0); $pagefunr['repagenum']=0; //取得分页 $truepage=InfoUsePage($thispagenum,$line,$page_line,$start,$page,$search,$pagefunr); //下拉式分页 if(strstr($newstemptext,'[!--title.select--]')) { for($j=0;$j<$thispagenum;$j++) { $spurl=eReturnRewritePageLink($pagefunr,$j); if($j==0) { $sptitle=$add[title]; } else { $ti_r=explode('[/!--empirenews.page--]',$n_r[$j]); $sptitle=count($ti_r)>=2?$ti_r[0]:$add[title].'('.($j+1).')'; } $select=''; if($page==$j) { $ptitle=$sptitle; $select=' selected'; } $titleselect.='<option value="'.$spurl.'"'.$select.'>'.$sptitle.'</option>'; } $titleselect='<select name="titleselect" onchange="self.location.href=this.options[this.selectedIndex].value">'.$titleselect.'</select>'; } //下一页链接 if($page==$thispagenum-1) { $thisnextlink=eReturnRewritePageLink($pagefunr,0); } else { $thisnextlink=eReturnRewritePageLink($pagefunr,$page+1); } } else { //checkpageno if($page!=0) { printerror('ErrorUrl','history.go(-1)',1); } } //返回替换验证字符 $docheckrep=ReturnCheckDoRepStr(); if($add[newstext]) { if(empty($public_r['dorepword'])&&$docheckrep[3]) { $add[newstext]=ReplaceWord($add[newstext]);//过滤字符 } if(empty($public_r['dorepkey'])&&$docheckrep[4]&&!empty($add[dokey]))//替换关键字 { $add[newstext]=ReplaceKey($add['newstext'],$add['classid']); } if($public_r['opencopytext']) { $add[newstext]=AddNotCopyRndStr($add[newstext]);//随机复制字符 } } //变量 $tempf=$emod_r[$mid]['tempf']; $fr=explode(',',$tempf); $fcount=count($fr)-1; //变量替换 $newstempstr=$newstemptext;//模板 for($i=1;$i<$fcount;$i++) { $f=$fr[$i]; $value=$add[$f]; if($f=='downpath')//下载地址 { if(strstr($newstemptext,'[!--downpath--]')) { $value=ReturnDownSoftHtml($add); } } elseif($f=='onlinepath')//观看地址 { if(strstr($newstemptext,'[!--onlinepath--]')) { $value=ReturnOnlinepathHtml($add); } } elseif($f=='morepic')//图片集 { if(strstr($newstemptext,'[!--morepic--]')) { $value=ReturnMorepicpathHtml($add); } } elseif($f=='newstime')//时间 { if(strstr($newstemptext,'[!--newstime--]')) { $value=date($formatdate,$value); } } elseif($f=='befrom')//信息来源 { if($docheckrep[1]&&strstr($newstemptext,'[!--befrom--]')) { $value=ReplaceBefrom($value); } } elseif($f=='writer')//作者 { if($docheckrep[2]&&strstr($newstemptext,'[!--writer--]')) { $value=ReplaceWriter($value); } } elseif($f=='titlepic')//标题图片 { if(empty($value)) {$value=$public_r[newsurl].'e/data/images/notimg.gif';} } elseif($f=='title')//标题 { } else//正常字段 { if(!strstr($emod_r[$mid]['editorf'],','.$f.',')) { if(strstr($emod_r[$mid]['tobrf'],','.$f.','))//加br { $value=nl2br($value); } if(!strstr($emod_r[$mid]['dohtmlf'],','.$f.','))//去除html { $value=RepFieldtextNbsp(ehtmlspecialchars($value)); } } } $newstempstr=str_replace('[!--'.$f.'--]',$value,$newstempstr); } //固定变量 $newstempstr=str_replace('[!--id--]',$add[id],$newstempstr); $newstempstr=str_replace('[!--classid--]',$add[classid],$newstempstr); $newstempstr=str_replace('[!--class.name--]',$class_r[$add[classid]][classname],$newstempstr); $newstempstr=str_replace('[!--ttid--]',$add[ttid],$newstempstr); $newstempstr=str_replace('[!--tt.name--]',$class_tr[$add[ttid]][tname],$newstempstr); $newstempstr=str_replace('[!--tt.url--]',sys_ReturnBqInfoTypeUrl($add['ttid']),$newstempstr); $newstempstr=str_replace('[!--onclick--]',$add[onclick],$newstempstr); $newstempstr=str_replace('[!--userfen--]',$add[userfen],$newstempstr); $newstempstr=str_replace('[!--username--]',$add[username],$newstempstr); //带链接的用户名 if($add[ismember]==1&&$add[userid]) { $newstempstr=str_replace('[!--linkusername--]',"<a href='".$public_r[newsurl]."e/space/?userid=".$add[userid]."' target=_blank>".$add[username]."</a>",$newstempstr); } else { $newstempstr=str_replace('[!--linkusername--]',$add[username],$newstempstr); } $newstempstr=str_replace('[!--userid--]',$add[userid],$newstempstr); $newstempstr=str_replace('[!--other.link--]',$keyboardtext,$newstempstr); $newstempstr=str_replace('[!--news.url--]',$public_r[newsurl],$newstempstr); $newstempstr=str_replace('[!--plnum--]',$add[plnum],$newstempstr); $newstempstr=str_replace('[!--totaldown--]',$add[totaldown],$newstempstr); $newstempstr=str_replace('[!--keyboard--]',$add[keyboard],$newstempstr); //链接 $titleurl=sys_ReturnBqTitleLink($add); $newstempstr=str_replace('[!--titleurl--]',$titleurl,$newstempstr); $newstempstr=str_replace('[!--page.stats--]','',$newstempstr); $classurl=sys_ReturnBqClassname($add,9); $newstempstr=str_replace('[!--class.url--]',$classurl,$newstempstr); //下一篇 if(strstr($newstemptext,'[!--info.next--]')) { $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"); if(empty($next_r[id])) { $infonext="<a href='".$classurl."'>".$fun_r['HaveNoNextLink']."</a>"; } else { //链接 $nexttitleurl=sys_ReturnBqTitleLink($next_r); $infonext="<a href='".$nexttitleurl."'>".$next_r[title]."</a>"; } $newstempstr=str_replace('[!--info.next--]',$infonext,$newstempstr); } //上一篇 if(strstr($newstemptext,'[!--info.pre--]')) { $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"); if(empty($next_r[id])) { $infonext="<a href='".$classurl."'>".$fun_r['HaveNoNextLink']."</a>"; } else { //链接 $nexttitleurl=sys_ReturnBqTitleLink($next_r); $infonext="<a href='".$nexttitleurl."'>".$next_r[title]."</a>"; } $newstempstr=str_replace('[!--info.pre--]',$infonext,$newstempstr); } //投票 if(strstr($newstemptext,'[!--info.vote--]')) { $myvotetext=sys_GetInfoVote($add[classid],$add[id]); $newstempstr=str_replace('[!--info.vote--]',$myvotetext,$newstempstr); } //评分 if(strstr($newstemptext,'[!--pinfopfen--]')) { $pinfopfen=$add[infopfennum]?round($add[infopfen]/$add[infopfennum]):0; $newstempstr=str_replace('[!--pinfopfen--]',$pinfopfen,$newstempstr); $newstempstr=str_replace('[!--infopfennum--]',$add[infopfennum],$newstempstr); } $string=$newstempstr; //替换变量 $string=str_replace('[!--p.title--]',strip_tags($ptitle),$string); $string=str_replace('[!--next.page--]',$thisnextlink,$string); $string=str_replace('[!--page.url--]',$truepage,$string); $string=str_replace('[!--title.select--]',$titleselect,$string); return $string; } if(empty($newstemp_r['tempid'])) { printerror('ErrorUrl','',1); } //页面支持标签 if($public_r['dtncanbq']) { $newstemp_r[temptext]=DtNewsBq('text'.$newstemp_r[tempid],$newstemp_r[temptext],1); } else { if($public_r['searchtempvar']) { $newstemp_r[temptext]=ReplaceTempvar($newstemp_r[temptext]); } } $string=DtGetHtml($r,$newstemp_r,$mid,$tbname,$line,$page_line,$start,$page,$search); //缓存 if($ecms_tofunr['cacheopen']==1) { Ecms_eCacheIn($ecms_tofunr,stripSlashes($string)); } else { echo stripSlashes($string); } //缓存 db_close(); $empire=null; ?>

2、增加内容页模板,模板内容与正常内容页模板一样调用,新建完成后记住内容页模板id。

3、增加伪静态规则:rewrite ^/bishun/zi-([0-9]+)\.html$ /e/action/bishun.php?classid=5&id=$1 last;

演示地址就是使用1个内容的信息用5个页面调出MSo零氪源码
MSo零氪源码
https://www.gushichi.com/bishun/zi-2606.htmlMSo零氪源码
MSo零氪源码
https://www.gushichi.com/wubi/zi-2606.htmlMSo零氪源码
MSo零氪源码
https://www.gushichi.com/wuxing/zi-2606.htmlMSo零氪源码
MSo零氪源码
https://www.gushichi.com/bushou/zi-2606.htmlMSo零氪源码
MSo零氪源码
https://www.gushichi.com/duyin/zi-2606.html

 MSo零氪源码


以上就是帝国CMS同一条信息使用不同的多个内容页模板伪静态实现教程的详细内容,更多请关注『零氪源码』其它相关文章!MSo零氪源码

 MSo零氪源码


内容加载中..
  • 231新增会员(位)
  • 0本年发布(个)
  • 0本月发布(个)
  • 0 今日发布(个)
  • 稳定运行(天)

零氪源码,欢迎你!


零氪源码致力于资源分享!

SVIP会员限时优惠,享受资源免费下载

内容持续更新,永不间断


所有资源均与网上收集整理,仅限交流学习使用

请自觉在下载后24小时内删除

勿用于非法用途,本站不承担任何责任

我知道了

回到顶部