[SEO优化] 帝国“当前位置导航”修改方法

[复制链接]
查看763 | 回复9 | 2019-1-11 23:06:31 | 显示全部楼层 |阅读模式

第一步:在e/class/userfun.php中加入下面的函数,函数只有一个参数,就是当前ID

//当前位置导航
function user_linknav($classid)
{
global $empire,$dbtbpre;
$query="select classname,bclassid,classpath from {$dbtbpre}enewsclass   where classid=".$classid;

$sql=$empire->query($query);
//echo "<a href = "/">首 页</a>";
while($r=$empire->fetch($sql))
{
findparent($r[bclassid]);
echo "&nbsp;>&nbsp;<a href ="/".$r[classpath]."">".$r[classname]."</a>";
}
}
//当前位置导航,递归查询父栏目
function findparent($classid)
{
global $empire,$dbtbpre;
$query="select classname,bclassid,classpath from {$dbtbpre}enewsclass   where classid=".$classid;

$sql=$empire->query($query);

while($r=$empire->fetch($sql))
{
findparent($r[bclassid]);
echo "&nbsp;>&nbsp;<a href ="/".$r[classpath]."">".$r[classname]."</a>";
}

}

第二步:在模块管理中添加标签,标签符号为linknav,函数名为 user_linknav,标签的格式为[linknav]栏目ID[/linknav]

第三步:添加模板变量 nav,内容为 " 您当前的位置:&nbsp;[linknav][!--self.classid--][/linknav] ”

最后。您只需要在模板中调用模板变量[!--temp.nav--] 即可。。。。。。。。。

具体样式可以吧 [!--temp.nav--] 放在一个div中。然后设置div的样式即可,也可以修改userfun下面的函数。。函数很简单。就是根据当前栏目向上递归查询

回复

使用道具 举报

123457846 | 2020-10-26 01:59:25 | 显示全部楼层
感谢悟空源码分享精品资源!
回复

使用道具 举报

数脚趾头耍媳 | 2020-11-4 13:34:13 | 显示全部楼层
厉害了,悟空源码资源多教程多!
回复

使用道具 举报

霓小沫儿 | 2021-1-14 17:11:13 | 显示全部楼层
支持悟空源码,越来越好
回复

使用道具 举报

王太保 | 2021-4-9 08:50:57 | 显示全部楼层
厉害了悟空源码,这么多资源
回复

使用道具 举报

林之秋实 | 2022-4-10 10:07:48 | 显示全部楼层
这个站很好,资源多,教程全
回复

使用道具 举报

创新2017 | 2022-5-9 09:47:07 | 显示全部楼层
找了好多地方,终于找到了
回复

使用道具 举报

牛股行天下烁 | 2022-6-1 07:17:51 | 显示全部楼层
加油!悟空源码,继续努力!支持你!
回复

使用道具 举报

hhhong2017 | 2022-6-3 12:55:44 | 显示全部楼层
感谢悟空源码分享精品资源!
回复

使用道具 举报

poney | 2023-1-19 04:41:50 | 显示全部楼层
祝愿悟空源码越办越好!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则