您现在的位置是:首页 > 教程 > dedecms教程dedecms教程

织梦Dedecms获取上一级栏目名称及链接的代码示例

梁尉寒2023-09-19 11:06:46dedecms教程已有人查阅

导读{dede:field name=typeid runphp=yes}global $dsql;/*获取当前栏目信息*/$typeid = @me;$qu

{dede:field name='typeid' runphp='yes'}
global $dsql;
/*获取当前栏目信息*/
$typeid = @me;
$query = "SELECT reid FROM dede_arctype where id = $typeid";
$rs = $dsql->GetOne($query);
$reid = $rs['reid'];//获取到栏目的上级栏目
/*获取上级栏目信息*/
$query2 = "SELECT * FROM dede_arctype where id = $reid";
$row = $dsql->GetOne($query2);
/*打印栏目上级栏目链接信息*/
$typename = $row['typename'];
$link = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'], $row['moresite'],$row['siteurl'],$row['sitepath']);
@me = "<a href='{$link}'>$typename</a>";
{/dede:field}

本文标签:

很赞哦! ()

留言与评论 (共有 条评论)
验证码:

本栏推荐

相关标签