Home > Article > Backend Development > LOOP universal tag loop in Dedecms dedecms calls arcurl tag (get link), dedecmsarcurl_PHP tutorial
In DEDECMSV5.3, the loop universal loop tag is provided, but this loop tag only The fields in the table can be looped out, but the "[field:arcurl/]" link tag cannot be parsed, and there is no relevant solution found on the official DEDECMS forum, so I have to write the code myself!
This is the official code:
{dede:loop table='dede_archives' sort='' row='4' if=''}
[field:title/]
{/dede:loop}
The following is my solution:
1. Open Include/common. func.php, find line 54, and add a function code here as follows:
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;
}
2. The writing of our calling method in the template has also changed. The code is as follows:
{dede:loop table='dede_archives' sort= '' row='4' if=''}
Do not use quotation marks after href=
http://www.bkjia.com/PHPjc/849147.html