欢迎来到元素模板ys720.com,本站提供专业的织梦模板PBOOTCMS模板网站模板网站修改/网站仿站
当前位置:主页 > 程序教程 > DEDECMS教程 >
DEDECMS教程

织梦Dedecms怎么获取上一级栏目名称及链接?

(元素模板) / 2022-06-18 11:27

下面就是织梦DEDECMS获取上一级栏目名称和链接的代码

{dede:field name='typeid' runphp='yes'}

                                global $dsql;

                                /*获取当前栏目信息*/

                                $typeid = @me;

                                $query = "SE LECT reid FROM dede_arctype where id = $typeid";

                                $rs = $dsql->GetOne($query);

                                $reid = $rs['reid'];//获取到栏目的上级栏目

                                

                                /*获取上级栏目信息*/

                                $query2 = "S ELECT * 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}

Copyright @ 2013-2021 元素模板 www.ys720.com All Rights Reserved. 版权所有 元素模板 www.ys720.com