织梦dedecms在列表页怎么获取当前地址链接、分页链接

织梦系统在列表页面怎么获取当前地址链接,以及在分页后的链接,从第二页开始的分页链接。这是dedecms二次开发必备。   实现什么呢?   获取列表页面当前地址链接。对伪静态、动态、静态页面兼容,支持第一页就是栏目链接,从列表页面第二页、第三页......   1.打开 include/arc.listview.class.php 找到  
else if($PageNo!=1 && $ctag->GetName()=='field' && $ctag->GetAtt('display')!='')
  在它的上面加入  
else if($ctag->GetName()=="itemcururl"){

if($ismake==0)

{



$this->dtp->Assign($tagid,$this->GetItemsCurUrlDM());

}

else

{



$this->dtp->Assign($tagid,$this->GetItemsCurUrlST());

}}
  继续找到   获得当前的页面文件的url   在它的注释上面加入  
/** *
获得当前栏目链接与当前分页链接 * * @access

public * @return

string * @return

{dede:itemcururl/} */function GetItemsCurUrlDM(){global $cfg_basehost,$cfg_multi_site;$purl = $this->GetCurUrl();

// 如果开启为静态,则对规则进行替换

if($cfg_rewrite == 'Y')

{



$nowurls = preg_replace("/-/", ".php?", $purl);



$nowurls = explode("?", $nowurls);



$purl = $nowurls[0];

}if($this->PageNo==1){$geturl = "tid=".$this->TypeID;$purl .= '?'.$geturl;}else{$geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";$purl .= '?'.$geturl."PageNo=".$this->PageNo;}$cururl = ($cfg_multi_site=='Y') ? $purl : $cfg_basehost.$purl;return $cururl;}function GetItemsCurUrlST(){global $cfg_basehost;

$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);

$tnamerule = preg_replace("/^(.*)//", '', $tnamerule);$cfg_basehost = preg_replace('#/$#','',$cfg_basehost);$tnamerule = MfTypedir($this->Fields['typedir']).'/'.$tnamerule;if($this->PageNo==1){$purl = MfTypedir($this->Fields['typedir']).'/';}else{$purl = str_replace("{page}",$this->PageNo,$tnamerule);}$cururl = ($cfg_multi_site=='Y') ? $purl : $cfg_basehost.$purl;return $cururl;}
  调用方法   在列表页面模板文件中,调用如下:  
{dede:itemcururl/}
 

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!
本文关键词:

联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com