<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

织梦{dede:loop}循环标签调用文章链接arcurl的方法

时间:2020-12-15

DedeCMS帮助手册提供的loop万能循环标签默认不支持[field:arcurl/]文章链接标签的直接调用,也就是[field:arcurl/]链接标签没法被解析生成,那么怎么解决这个问题呢?

我们先看看loop万能循环标签代码,代码如下:

 

{dede:loop table='dede_archives' sort='' row='4' if=''} 
<a href='[field:arcurl/]'>[field:title/]</a> 
{/dede:loop}

 

下面我们自己动手,添加一个函数。

找到并打开/include/common.func.php文件,在里面找到54行,再这里添加一个函数代码如下:

 

function IDReturnURL($ID) 

global $dsql; 
$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault, 
tp.defaultname,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath 
from dede_archives arc left join dede_arctype tp on arc.typeid=tp.id where arc.id = ".$ID; 
$row = $dsql->GetOne($query); 
$ReturnURL = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
return $ReturnURL; 
}

 

二、模板中的调用写法,代码如下:

 

{dede:loop table='dede_archives' sort='' row='4' if=''} 
<li><a href='[field:id function=IDReturnURL(@me)/]'>[field:title function=cn_substrR(@me,44)/]</a></li> 
{/dede:loop}

 

另外,如果你要用在自定义sql标签里,则代码如下:

 

[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]

0
首页
案例
关于
联系