Keep updating ~ To make a desired version, add a tree menu on the list page

Source: Internet
Author: User
Keep updating ~ To make a desired version, add a tree-type menu on the list page. The Post is last updated by the version xjl756213616 in 2013-06-0420: 00: 30, with an English name & nbsp; "Pursue", address: http: // www. keep updating ~ To make a desired version, add a tree menu on the list page
At the end of this post, xjl756213616 was edited and updated again at 20:00:30 on. The English name "Pursue" was obtained ",

Address: http://www.youyax.com/forum/
PHP open-source forum system-YouYaX Pursue version update

This update adds the tree menu function to the list page.
I wrote it directly on the list page.

The tree-like js code is plagiarized, and is mainly used to connect to the database.
Previously, the ztree plug-in with better results was used on the list page of the official website, but it was implemented based on jquery,
I still don't like jquery.


Update code


var data=[
$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:' ',s:[ $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:' ',url:'{site}/index.php/List{url}index{url}f{url} {shtml}'},  }
 }
?>
]}, }
}
}
}
?>
];
var et=new Tree(data,'treediv');
var dts=document.getElementById("treediv").getElementsByTagName("dt");
for(var i=0;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》
Share with YouYaX:
------ Solution --------------------
It's really good. a newbie is here to support the landlord!
------ Solution --------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.