本文實(shí)例講述了dedecms子欄目中調(diào)用其所屬頂級(jí)欄目的名稱和簡(jiǎn)介的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
頂級(jí)欄目的名稱及鏈接:
復(fù)制代碼代碼如下:{dede:field name='id' runphp="yes"}
global $cfg_basehost,$cfg_cmspath,$cfg_indexurl;
$dsql = new DedeSql(false);
$a="SELECT tp.reid FROM dede_arctype as tp where ";
$arcRow = $dsql->GetOne($a);
@me="$arcRow[reid]";
if(@me==0)@me='首頁(yè)';
else {$b="SELECT * FROM dede_arctype as tp where ";
$tpRow = $dsql->GetOne($b);
@me=''.$tpRow[typename].'';
$url=$cfg_basehost.$cfg_cmspath;
@me=str_replace('{cmspath}',$url,@me);
}
$dsql->Close();
{/dede:field}
欄目描述:
復(fù)制代碼代碼如下:{dede:field name='id' runphp="yes"}
$dsql = new DedeSql(false);
$a="SELECT tp.reid FROM dede_arctype as tp where ";
$arcRow = $dsql->GetOne($a);
@me="$arcRow[reid]";
if(@me==0)@me='';
else {$b="SELECT * FROM dede_arctype as tp where ";
$tpRow = $dsql->GetOne($b);
@me=$tpRow[description];
$dsql->Close();
{/dede:field}
希望本文所述對(duì)大家的dedecms建站有所幫助。
更多信息請(qǐng)查看IT技術(shù)專欄