帝国cms完美替换当前位置导航
第一步:在e/class/userfun.php中加入下面的函数,函数只有一个参数,就是当前ID//当前位置导航function user_linknav($classid){global $empire,$dbtbpre;$query="select classname,bclassid,classpath from {$dbtbpre}en……
第一步:在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 " > <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 " > <a href ="/".$r[classpath]."">".$r[classname]."</a>";}}
第二步:在模块管理中添加标签,标签符号为linknav,函数名为 user_linknav,标签的格式为[linknav]栏目ID[/linknav]第三步:添加模板变量 nav,内容为 " 您当前的位置: [linknav][!--self.classid--][/linknav] ”最后。您只需要在模板中调用模板变量[!--temp.nav--] 即可。。。。。。。。。具体样式可以吧 [!--temp.nav--] 放在一个div中。然后设置div的样式即可,也可以修改userfun下面的函数。。函数很简单。就是根据当前栏目向上递归查询
- 上一篇
帝国cms按照小时显示更新数量怎么实现
用帝国cms程序之sql调用12小时:<?=$empire->gettotal("select count(*) as total from phome_ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600")?>6小时:<?=$empire->gettotal("select count(*) as total from phome_
- 下一篇
sql调用点击排行和顶排行可指定栏目ID
[ecmsinfo]"select * from phome_4ecms_news where checked=1 order by diggtop desc,id desc limit 10",10,30,0,24,10,0[/ecmsinfo]这个是顶的排行[ecmsinfo]"select * from phome_4ecms_news where newspath >SUBD