元素模板为您解答:
代码例子:
{dede:sql}<li>标题:<a href="[field:id function='GetOneDocUrl(@me)'/]">[field:title/]</a></li> {/dede:sql}
红色部分就是静态链接代码,还需要以下操作
GetOneDocUrl 函数 放到incluce/extend.func.php 文件中,这个函数是用来调用文档的静态URL的。
function GetOneDocUrl($aid){global $dsql;include_once(DEDEINC."/channelunit.func.php");$aid = trim(ereg_replace('[^0-9]','',$aid));$chRow = $dsql->GetOne("Select arc.*,ch.maintable,ch.addtable,ch.issystem From `dede_arctiny` arc left join `dede_channeltype` ch on ch.id=arc.channel where arc.id='$aid' ");if(!is_array($chRow)) {return $reArr;}else {if(empty($chRow['maintable'])) $chRow['maintable'] = 'dede_archives';}if($chRow['issystem']!=-1){$nquery = " Select arc.*,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepathFrom `{$chRow['maintable']}` arc left join `dede_arctype` tp on tp.id=arc.typeidwhere arc.id='$aid' ";}else{$nquery = " Select arc.*,1 as ismake,0 as money,'' as filename,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepathFrom `{$chRow['addtable']}` arc left join `dede_arctype` tp on tp.id=arc.typeidwhere arc.aid='$aid' ";}$arcRow = $dsql->GetOne($nquery);$Url = GetFileUrl($aid,$arcRow['typeid'],$arcRow['senddate'],$reArr['title'],$arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);return $Url;}