織夢獲取當前鏈接url網上有很多教程,但是要么只支持動態下正常使用,要么只支持內容頁使用
一個標簽,可用于任意模板下使用
支持動態/靜態/偽靜態 輸出當前url
支持首頁/列表頁/列表分頁/內容頁/內容頁分頁
實現教程
1、獲取內容頁當前Url 或者 內容頁分頁Url
打開 /include/arc.archives.class.php 找到
$this->NowPage = $pageNo;
在它上面加入
$ArcArr = GetOneArchive($this->ArcID);
$arcurl = $ArcArr['arcurl'];
繼續找到
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
在它上面加入


01if($ismake==1)
02 
03{
04 
05if($pageNo>1)
06 
07{
08 
09$pagebreak = str_replace($this->NameFirst, $this->NameFirst."_".$pageNo, $arcurl);
10 
11}
12 
13}
14 
15else
16 
17{
18 
19if($pageNo>1) $pagebreak = "&pageno=".$pageNo;
20 
21if($cfg_rewrite == 'Y')
22 
23{
24 
25$pagebreak = str_replace(".php?aid=", "-", $arcurl);
26 
27$pagebreak =  preg_replace("#&pageno=(d+)#i", '-.html', $pagebreak);
28 
29}
30 
31$pagebreak = $arcurl.$pagebreak;
32 
33}

 2、獲取列表頁當前Url 或者 列表頁分頁Url
打開 /include/arc.listview.class.php 找到
//替換第二頁后的內容
在它上面加入

01$this->Fields['itemcururl'] = $this->GetItemsCurUrl($PageNo);
02 
03 
04 
05繼續找到
06 
07function GetCurUrl()
08 
09在它上面加入
10 
11function GetItemsCurUrl($PageNo)
12 
13{
14 
15global $cfg_basehost;
16 
17if($this->TypeLink->TypeInfos['isdefault']==-1)
18 
19{
20 
21$purl = $this->GetCurUrl();
22 
23if($cfg_rewrite == 'Y')
24 
25{
26 
27$nowurls = preg_replace("/-/", ".php?", $purl);
28 
29$nowurls = explode("?", $nowurls);
30 
31$purl = $nowurls[0];
32 
33}
34 
35if($PageNo==1)
36 
37{
38 
39$geturl = "tid=".$this->TypeID;
40 
41$purl .= '?'.$geturl;
42 
43}
44 
45else
46 
47{
48 
49$geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";
50 
51$purl .= '?'.$geturl."PageNo=".$PageNo;
52 
53}
54 
55}
56 
57else
58 
59{
60 
61$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->

Fields[
'typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
62 
63$tnamerule = preg_replace("/^(.*)//", '', $tnamerule);
64 
65$cfg_basehost = preg_replace('#/$#','',$cfg_basehost);
66 
67$tnamerule = MfTypedir($this->Fields['typedir']).'/'.$tnamerule;
68 
69if($PageNo==1)
70 
71{
72 
73$purl = MfTypedir($this->Fields['typedir']).'/';
74 
75}
76 
77else
78 
79{
80 
81$purl = str_replace("{page}",$PageNo,$tnamerule);
82 
83}
84 
85}
86 
87return $purl;
88 
89}
90 
91 
92 
93還需要打開 /include/arc.partview.class.php 找到
94 
95$this->Fields['title'] = $this->TypeLink->GetPositionLink(false);
96 
97在它下面加入
98 
99$this->Fields['itemcururl'] = $this->TypeLink->GetOneTypeUrl($this->TypeLink->TypeInfos);

 前臺模板標簽調用
{dede:field.itemcururl runphp=yes}global $cfg_basehost;@me = (@me == '' ? "{$cfg_basehost}" : "{$cfg_basehost}@me");{/dede:field.itemcururl}

織夢一個標簽獲取當前鏈接地址url支持動態、靜態、偽靜態輸出當前鏈接url

?