帝国CMS   发布时间:2022-05-06  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了完美替换“当前位置导航”大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

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

第一步:在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,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下面的函数。。函数很简单。就是根据当前栏目向上递归查询

大佬总结

以上是大佬教程为你收集整理的完美替换“当前位置导航”全部内容,希望文章能够帮你解决完美替换“当前位置导航”所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: