栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP > php开源框架 > dedecms

织梦列表页获取当前链接和当前分页链接

dedecms 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

织梦列表页获取当前链接和当前分页链接

兼容静态 动态 伪静态

支持第一页直接是栏目链接,第二页,第三页。。。。按当前分页

支持在开启绝对路径和没开启绝对路径不同输出

 

实现教程

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

在它的注释上面加入

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  www.dede58.com织梦模板 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/}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/8059.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号