好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 網(wǎng)站建設(shè) > 建站知識 > DedeCMS系統(tǒng)datalist標(biāo)簽調(diào)用arcurl方法

DedeCMS系統(tǒng)datalist標(biāo)簽調(diào)用arcurl方法

POST TIME:2020-04-10 20:59

DedeCMS系統(tǒng)datalist標(biāo)簽調(diào)用arcurl方法(本文未測試,請自行測試可行性),使用datalist時,無法直接調(diào)用arcurl值。arclist標(biāo)記使用[field:arcurl]可以直接調(diào)出文章url,在sql標(biāo)簽中也可以調(diào)出文章url:

[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]
 
datalist標(biāo)簽不能直接調(diào)用arcurl字段,可以擴(kuò)展函數(shù)。sql標(biāo)簽調(diào)用時GetOneArchive函數(shù),打開include文件夾下common.func.php文件找到GetOneArchive函數(shù):
 
//獲取單篇文檔信息
 
function GetOneArchive($aid)
{
global $dsql;
include_once(DEDEINC."/channelunit.func.php");
$aid = trim(ereg_replace('[^0-9]','',$aid));
$reArr = array();
 
$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.sitepath
From `{$chRow['maintable']}` arc left join `dede_arctype` tp on tp.id=arc.typeid
where 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.sitepath
From `{$chRow['addtable']}` arc left join `dede_arctype` tp on tp.id=arc.typeid
where arc.aid='$aid' ";
}
$arcRow = $dsql->GetOne($nquery);
 
if(!is_array($arcRow)) {
return $reArr;
}
if(!isset($arcRow['description'])) {
$arcRow['description'] = '';
}
 
if(empty($arcRow['description']) && isset($arcRow['body'])) {
$arcRow['description'] = cn_substr(html2text($arcRow['body']),250);
}
 
if(!isset($arcRow['pubdate'])) {
$arcRow['pubdate'] = $arcRow['senddate'];
}
 
if(!isset($arcRow['notpost'])) {
$arcRow['notpost'] = 0;
}
 
$reArr = $arcRow;
$reArr['aid'] = $aid;
$reArr['topid'] = $arcRow['topid'];
$reArr['arctitle'] = $arcRow['title'];
$reArr['arcurl'] = 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 $reArr;
 
}
 
這里,它處理$aid返回了一個$reArr數(shù)組,此數(shù)組有arcurl這個元素,這下很好理解sql標(biāo)簽中調(diào)用arcurl的方法了。
找到GetOneArchive函數(shù),打開include文件夾下extend.func.php,加入以下代碼:
 
function getOneArchiveElement($aid,$element='arcurl'){
 
$arcRow=GetOneArchive($aid);
 
return $arcRow[$element];
 
}
 
在模板文件datalist標(biāo)記里調(diào)用如下標(biāo)簽:
 
{dede:field.aid function="GetOneArchiveElement(@me,'arcurl')"}
 
@me是傳遞參數(shù)aid的功能www.genban.org
 
OK,這樣就搞定了datalist標(biāo)簽中調(diào)用arcurl的問題,當(dāng)然GetOneArchiveElement這個函數(shù)還可以調(diào)用其他字段的值。


收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266