当使用软件模型而且只有一个下载地址时,我们都喜欢用本地地址,在列表页时直接输出这个地址,方便访客下载。
打开 includeextend.func.php 添加个方法
if (!function_exists('GetDownlink'))
{
function GetDownlink($aid)
{
global $dsql;
$row= $dsql->GetOne("SELECt softlinks FROM `dede_addonsoft` WHERe aid = {$aid}");
if(!is_array($row)){
return '';
}
else{
$dtp = new DedeTagParse();
$dtp->LoadSource($row['softlinks']);
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName()=='link')
{
$link = trim($ctag->GetInnerText());
}
}
}
return $link;
}
}
|
前台模板中调用
首页/列表页
[field:id function=GetDownlink(@me)/]
内容页
{dede:field.id function=GetDownlink(@me)/}



