dedecms子栏目中调用其顶级栏目名称和简介的方法
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>本文实例讲述了dedecms子栏目中调用其所属顶级栏目的名称和简介的方法。分享给大家供大家参考。具体实现方法如下:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<strong>顶级栏目的名称及链接:</strong><br>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode4" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
{dede:field name='id' runphp="yes"} <br>
global $cfg_basehost,$cfg_cmspath,$cfg_indexurl; <br>
$dsql = new DedeSql(false); <br>
$a="SELECT tp.reid FROM dede_arctype as tp where tp.id=@me"; <br>
$arcRow = $dsql->GetOne($a); <br>
@me="$arcRow"; <br>
if(@me==0)@me='首页'; <br>
else {$b="SELECT * FROM dede_arctype as tp where tp.id=@me"; <br>
$tpRow = $dsql->GetOne($b); <br>
@me=''.$tpRow.''; <br>
$url=$cfg_basehost.$cfg_cmspath; <br>
@me=str_replace('{cmspath}',$url,@me); <br>
} <br>
$dsql->Close(); <br>
{/dede:field}</div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>栏目描述:</strong><br><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode5" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
{dede:field name='id' runphp="yes"} <br>
$dsql = new DedeSql(false); <br>
$a="SELECT tp.reid FROM dede_arctype as tp where tp.id=@me"; <br>
$arcRow = $dsql->GetOne($a); <br>
@me="$arcRow"; <br>
if(@me==0)@me=''; <br>
else {$b="SELECT * FROM dede_arctype as tp where tp.id=@me"; <br>
$tpRow = $dsql->GetOne($b);<br>
@me=$tpRow; <br>
$dsql->Close(); <br>
{/dede:field}</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
希望本文所述对大家的dedecms建站有所帮助。</p>
頁:
[1]