织梦dedecms获取当前栏目的上级栏目的方法:
{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>";//这里面的这个A标签可以随意加代码,比如"<li><a href='{$link}'>{$typename}</a></li>"
{/dede:field}
{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>";//这里面的这个A标签可以随意加代码,比如"<li><a href='{$link}'>{$typename}</a></li>"
{/dede:field}
本站部分文章搜集整理于互联网或者网友提供,如有侵权请联系站长
如若转载,请注明出处:https://htmlbk.com/dedecms/474.html
温馨提示:该文档最后一次修改时间为2020-04-07 09:41:15,请注意相关的内容是否还可用!