dedeCMS怎样返回上一级目录 获取当前上一级栏目名称及链接
{dede:channel type='top' row='80'}
<li><a href="[field:typeurl/]">[field:typename/]</a></li>
{/dede:channel}
部分换成
{dede:channelartlist }
<div class="样式1">
{dede:type}<li class="clearfix"><a class="f_l">[field:typename/]</a></li>{/dede:type}
<span>
{dede:channel type='son' noself='yes'}
<a href="[field:typeurl/]" title="[field:typename/]">[field:typename/]</a>|{/dede:channel}
</span>
</div>
{/dede:channelartlist}
这是子栏目调用:
{dede:channel type='son'}
<li><a href="[field:typeurl/]">[field:typename]</a></li>
{/dede:channel}
{dede:field name='typeid' runphp='yes'}
global $dsql;
/获取当前栏目id/
$typeid = @me;
$query = "SELECT reid FROM dede_arctype where id = $typeid";
$rs = $dsql->GetOne($query);
$reid = $rs['reid'];//获取到栏目的上级栏目
/获取上级栏目id/
$query2 = "SELECT FROM dede_arctype where id = $reid";
$typerow = $dsql->GetOne($query2);
/输出上级栏目信息/
$typename = $typerow['typename'];
$link = GetTypeUrl($typerow['typeid'],MfTypedir($typerow['typedir']),$typerow['isdefault'],$typerow['defaultname'],$typerow['ispart'],$typerow['namerule2'],$typerow['moresite'],$typerow['siteurl'],$typerow['sitepath']);
@me = "<a href='/{$link}'>$typename</a>";
{/dede:field}
后台dedecms系统配置参数里面的站点根网址设置成这样就行了,再或者是这样,添加栏目的时候外链填写,文件保存目录是下面所示
再不行的话联系我
0条评论