我们知道织梦模板可以在后台直接设置成静态HTML,但是如果你是一个数据量非常大的网站,更改模板后,重新生成HTML,试试想10W数据,重新生成一遍的难度。所在这里我想到了一个用urlwrite实现的伪静态URL的方法。
提示:用urlwrite实现的伪静态,服务器支持urlwrite。
修改方法
编辑文件
include/inc_channel_unit_functi*****.php
第107行改为
if($rank!=0||$ismake==-1||$typeid==0||$money>0){ //动态文章
//return $GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
//keminar 修改
$articleDir = MfTypedir($artdir);
if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
return $articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
}
第52行改为
if($rank!=0||$ismake==-1||$typeid==0||$money>0) //动态文章
{
if($GLOBALS['cfg_multi_site']=='Y')
{
$siteurl = $GLOBALS['cfg_basehost'];
}
//return $siteurl.$GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
//keminar 修改
$articleDir = MfTypedir($artdir);
if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
return $siteurl.$articleDir."/".GetPinyin($title)."_aid_".$aid.".html";
}
第146行改为
if($isdefault==-1)
{
//$reurl = $GLOBALS["cfg_plus_dir"]."/list.php?tid=".$typeid;
//keminar 修改
$reurl = $GLOBALS["cfg_cmspath"]."/".$typedir."_tid_".$typeid.".html";
}else if($ispart>0)
修改文件
include/inc_arclist_view.php
第810行改为
$purl = $this->GetCurUrl();
//keminar 修改
$t = strpos($purl,'_tid_');
$purl = substr($purl,0,$t);
$geturl = "tid_".$this->TypeID."_";
//$hidenform = "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";
//$hidenform .= "<input type='hidden' name='totalresult' value='".$this->totalresult."'>\r\n";
$purl .= "_".$geturl;
//获得上一页和下一页的链接
if($this->pageno != 1){
$prepage.="<a href='".$purl."pageno_".$prepagenum.".html'>上一页</a>\r\n";
$indexpage="<a href='".$purl."pageno_1.html'>首页</a>\r\n";
}
else{
$indexpage="<a href='#'>首页</a>\r\n";
}
if($this->pageno!=$totalpage && $totalpage>1){
$nextpage.="<a href='".$purl."pageno_".$nextpagenum.".html'>下一页</a>\r\n";
$endpage="<a href='".$purl."pageno_".$totalpage.".html'>末页</a>\r\n";
}
else{
$endpage="末页\r\n";
}
//获得数字链接
$listdd="";
$total_list = $list_len * 2 + 1;
if($this->pageno >= $total_list) {
$j = $this->pageno-$list_len;
$total_list = $this->pageno+$list_len;
if($total_list>$totalpage) $total_list=$totalpage;
}else{
$j=1;
if($total_list>$totalpage) $total_list=$totalpage;
}
for($j;$j<=$total_list;$j++){
if($j==$this->pageno) $listdd.= "<strong>$j</strong>\r\n";
else $listdd.="<a href='".$purl."pageno_".$j.".html'>".$j."</a>\n";
}
$plist = "";
//$plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";
$plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage;
if($totalpage>$total_list){
$plist.="<input type='text' name='pageno' id='pageno' value='".$this->pageno."'>\r\n";
$plist.="<input type='button' id='button' name='plistgo' value='GO' onclick='plistgo();'>\r\n";
}
//$plist .= "</form>\r\n";
$plist .= "<script type='text/javascript'>\r\n
function plistgo(){
var pageno = document.getElementById(\"pageno\").value;
window.location.href='".$purl."pageno_'+pageno+'.html';
};</script>";
return $plist;
修改模板
templets/jinsuo/article_image.htm
第10行添加
var url = location.href;
var t = url.indexOf('_aid_');
var aurl = url.slice(0,t);
第42行修改
if(npage==2){
if(namehand!='') location.href = namehand+".html";
else location.href = aurl+"_aid_{dede:field name='id'/}"+".html";
}else if(displaytype=='st' && namehand!=''){
location.href = namehand+"_"+(npage-1)+".html";
}else{
location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage-1)+".html";
}
}
}
//下一张
function dPlayNext(){
if(npage==totalpage){ alert("没有了哦"); }
else{
if(displaytype=='st' && namehand!='') location.href = namehand+"_"+(npage+1)+".html";
else location.href = aurl+"_aid_{dede:field name='id'/}_pageno_"+(npage+1)+".html";
|