實例:
//通過會員ID查看會員名稱的函數(shù)
function GetMemberName($str){
$dsql = new Dedesql(false);
$row = $dsql->GetOne("SELECT uname FROM `ddmx_member` WHERE mid = '$str' ");
return $row[uname];
}
前臺模板調(diào)用[field:mid function="GetMemberName(@me)"/]
//通過ID號獲取類別的鏈接
function GetTypeUrl($tid)
{
global $dsql;
global $cfg_cmspath;
$query ="select typedir from ‘#` where ;
if($row=$dsql->getone($query))
{
$temp=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']).'/';
}
return $temp;
}
//通過ID號獲取文章的鏈接
function zGetArticleUrl($id)
{
global $dsql;
global $cfg_cmspath;
$query ="select id,typedir,namerule from ‘#` where typeid from ‘#` where ;
if($row = $dsql->getone($query))
{
$arc=$row['namerule'];
$type=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']);
$temp=str_replace("{typedir}",$type,$temp);
$temp=str_replace("{aid}",$id,$temp);
}
return $temp;
}
版權聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉載請注明: 織夢CMS/Dedecms添加自定義函數(shù)