DedeCMS系統datalist標簽調用arcurl方法,織夢教程
導讀:織夢教程織夢教程★DedeCMS系統datalist標簽調用arcurl方法★簡介: DedeCMS系統datalist標簽調用arcurl方法(本文未測試,請自行測試可行性)dede模板下載。
DedeCMS系統datalist標簽調用arcurl方法(本文未測試,請自行測試可行性),使用datalist時,無法直接調用arcurl值。arclist標記使用[field:arcurl]可以直接調出文章url,在sql標簽中也可以調出文章url:
[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id] datalist標簽不能直接調用arcurl字段,可以擴展函數。sql標簽調用時GetOneArchive函數,打開include文件夾下common.func.php文件找到GetOneArchive函數: //獲取單篇文檔信息 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)) { &ndede模板安裝bsp; 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 a夢織模板rc.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'], &n模板織夢bsp; $arcRow['filename'],$arcRow['moresite'], $arcRow['siteurl'],$arcRow['sitepath']); return $reArr; } 這里,它處理$aid返回了一個$reArr數組,此數組有arcurl這個元素,這下很好理解sql標簽中調用arcurl的方法了。 找到GetOneArchive函數,打開include文件夾下extend.func.php,加入以下代碼: function getOneArchiveElement($aid,$element='arcurl'){ $arcRow=GetOneArchive($aid); return $arcRow[$element]; } 在模板文件datalist標記里調用如下標簽: {dede:field.aid function="GetOneArchiveElement(@me,'arcurl')"} @me是傳遞參數aid的功能www.genban.org OK,這樣就搞定了datalist標簽中調用arcurl的問題,當然GetOneArchiveElement這個函數還可以調用其他字段的值。 相關dede模板下載。聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-20 ,文章DedeCMS系統datalist標簽調用arcurl方法,織夢教程主要講述標簽,標題,url網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_31222.html