版本再次更新,取了一个英文名 "Pursue",
地址:http://www.youyax.com/forum/
PHP开源论坛系统--YouYaX Pursue版本更新
本次更新在列表页面加入了树形菜单功能。
直接写在列表页里了
树形js代码是抄袭的,自己主要是实现了和数据库连接。
之前在官网列表页用了效果更好的ztree插件,不过它是基于jquery实现的,
还是不喜欢用jquery
更新代码部分
<div style="position:absolute;width:180px;overflow-x:hidden" id="treediv" class="tree"></div>
<script type="text/javascript">
var data=[
<?php
$sql="select bid,count(distinct bid),max(ssort) as st from " .C('db_prefix'). "small_block group by bid order by st desc";
$query=mysql_query($sql);
$num=mysql_num_rows($query);
if($num>0){
while($arr=mysql_fetch_array($query)){
$ssql="select * from " .C('db_prefix'). "big_block where id=".$arr['bid'];
$squery=mysql_query($ssql);
$snum=mysql_num_rows($squery);
if($snum>0){
while($sarr=mysql_fetch_array($squery)){
?>
{t:'<?php echo $sarr['bzone']; ?>',s:[<?php
$ssql2="select * from " .C('db_prefix'). "small_block where bid=".$sarr['id'];
$squery2=mysql_query($ssql2);
$snum2=mysql_num_rows($squery2);
if($snum2>0){
while($sarr2=mysql_fetch_array($squery2)){
?>{t:'<?php echo $sarr2['szone'];?>',url:'{site}/index.php/List{url}index{url}f{url}<?php echo $sarr2['id']; ?>{shtml}'},<?php
}
}
?>
]},<?php
}
}
}
}
?>
];
var et=new Tree(data,'treediv');
var dts=document.getElementById("treediv").getElementsByTagName("dt");
for(var i=0;i<dts.length;i++){
if(document.all) {dts[i].click();}
else {
var e = document.createEvent("MouseEvents");
e.initEvent("click", false, false);
dts[i].dispatchEvent(e);
}
}
var navH = document.getElementById("treediv").offsetTop;
window.onscroll=function(){
var scroH = window.pageYOffset|| document.documentElement.scrollTop || document.body.scrollTop;
if (scroH >= navH) {
document.getElementById("treediv").style.position="fixed";
document.getElementById("treediv").style.top=0;
} else if (scroH < navH) {
document.getElementById("treediv").style.position="absolute";
document.getElementById("treediv").style.top="30px";
}
}
</script>
YouYaX
------解决方案--------------------
真心不错,新手来支持楼主一下!
------解决方案--------------------