Jump to content


Photo

Nav Tree


  • Please log in to reply
2 replies to this topic

#1 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 07 May 2006 - 06:25 PM

Sup, I am trying to figure out how to make a nav menu that pulls Categories, SubCategories, and Category ID's from my database. (MySQL) Then make a navigation tree with the data.

I'll tell ya before I go any further, this is part of a script I bought. I know it's very sloppy and some of it is pretty retarded... However, I'd have to recode the entire thing to fix most of it.
Anyway, currently I have this script.

<?php
  $self = $_SERVER['PHP_SELF'];
  $get22 = "SELECT cId, cName, gamesnumber FROM categories WHERE cVisible = 1 AND mcid = '1' ORDER BY $cat_sort ASC";
  $result22 = @mysql_query($get22);
  while (list($id, $name, $gamesnumber) = @mysql_fetch_row($result22)) {
      echo "<a href=./test.php?lid=$id class=catename>$name<br>";
  }
  $gameid5 = $_GET['lid'];
  if (!isset($gameid5)) {
      $gameid5 = "10";
  }
  $get22 = "SELECT cId, cName, gamesnumber FROM categories WHERE cVisible = 1 AND mcid = '0' AND  pcid ='$gameid5' ORDER BY $cat_sort ASC";
  $result22 = @mysql_query($get22);
  while (list($id, $name, $gamesnumber) = @mysql_fetch_row($result22)) {
      echo "<a href=./test.php?action=category&id=$id&page=0&order2=game_name&sby=ASC class=catesub>- $name <i>($gamesnumber)</i><br>";
  }
?>
Which displays something like this:

Cartoons
Games
Movies
- Cartoons (0)

Cartoons
Games
Movies
- Action / Adventure (0)
- Sports (0)
- Other (0)

Cartoons
Games
Movies
- Commercials (0)
- Misc (0)
- Pranks (0)
- Sports (0)


As you see it keeps displaying them at the bottom of the page, plus it has to reload the page each time.
I am wanting a JS menu so that it won't reload the page each time, and a tree so it's easier to understand.
However, I know nothing about combining PHP/JS.
Could someone assist me in a situation like this please?
Thanks,
--ShibSta
(PS: Sorry if this is the wrong forum, it sorta fit under 3 different ones.)

#2 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 08 May 2006 - 07:36 PM

^^Bump

#3 haydndup

haydndup
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationJohannesburg, South Africa

Posted 08 May 2006 - 08:02 PM

If you are wanting to update content without refreshing the page, you are going to need to have a look at XMLHTTPRequest. [a href=\"http://www.ajaxfreaks.com/tutorials.php\" target=\"_blank\"]Ajax Freaks[/a] has some nice tutorials etc. Not much good at JS i'm afraid, so i can't help you there. Good Luck.
[!--coloro:#660000--][span style="color:#660000"][!--/coloro--]The Gene Pool Could Use A Little Chlorine[!--colorc--][/span][!--/colorc--]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users