JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 1st, 2002, 07:58 AM
hopsakee hopsakee is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 29 hopsakee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Building DHTML menu with PHP

Hi!

I'm trying to build a script that makes it possible to generate a dhtml navigation menu. The plan is to distinguish several levels of hierarchy (using the output of a database), in this case three: category, product, item.
Realising a complete exposition will distract you from further reading, I simply would like to ask for some idea's how to do this.
An example of the appearence of the menu can be found at www.samsung.nl (difference: no images are to be used).
Thanks!

Max

Reply With Quote
  #2  
Old January 1st, 2002, 10:17 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
If you're able to write the DHTML you're pretty much there. All you need to do is see which entities repeat, what data is variable, and what you need to extract with PHP. Then it's simply a matter of echoing the right data.
__________________
--
Regards
André Nęss

Puritanism: The haunting fear that someone, somewhere may be having fun

Reply With Quote
  #3  
Old January 1st, 2002, 02:20 PM
hopsakee hopsakee is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 29 hopsakee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've got not too much experience with DHTML, but the technique, used at www.samsung.nl, is not very difficult. Problem for me is to write a script, that, regardless the number of levels in the menu, can automate the process of making the menu.
Although not al the comments are translated from dutch, here you find the first lines of my script:
PHP Code:
<?
require("connect.php");

// MenuBuilder. Twee versies: IE4+ en anders --> I specify a browsercheck

$browserinfo explode(";",$HTTP_USER_AGENT);
if((
substr($browserinfo[1],1,4) == "MSIE")&&(substr($browserinfo[1],6,3) >= 4))
 { 

// IE4+ menu
// Variabelen instellen --> coming section is declaring some variables

$bgcolor     "#888888";
$bgcolordir  "#aaaaaa"//Als er nog resultaten op lager niveau achterzitten
$borderstyle "solid";
$borderwidth "1px";
$bordercolor "#000000";
$bgtextcolor "#ffff99";
$textcolor   "#000000";
$fontsize    "9px";
$fontfamily  "helvetica, verdana, arial";
$menubreedte "120px";

// Afhankelijk van het aantal niveaus subpag's instellen (doelgroepen achterwege gelaten => eerst dynamisch deel werkende krijgen)
$subpag         = array("$dir_pagina/categorie.php3?ID=","$dir_pagina/product.php3?ID=","$dir_pagina/item.php3?ID="); //hoogste niveau eerst (=> means: highest level first)

// Afhankelijk van het aantal niveaus de tabelnamen specificeren
$sub         = array("categorie","product","item"); //hoogste niveau eerst

// Bepaal de koppeling tussen categorieėn. Eerste is altijd leeg. => here the ID's how to relate the levels to each other are specified
$koppeling   = array("","CatID","ProductID");

// Bepaal wat te laten zien voor de listing => fieldnames for displaying in the menu are specified
$show        = array("CatNaam","ProductNaam","ItemNaam");

// Bepaal de naam van de IDvariabelen
$idvar         = array("CatID","ProductID","ItemID");

// Aantal niveaus => count the number of levels
$aantal_niveaus count($sub);

// Niveaus opbouwen
$datasub  = array();
$countsub = array();

for(
$i=0$i<$aantal_niveaus$i++)
 {
  echo 
"niveau $i <br>";
  echo 
$show[$i]."<br>";
  
  
// resetten
  
$query_ext "";

  if(
$i!=0)
     {
      
$query_ext "WHERE $koppeling[$i] = ??";
     }

  
$datasub[$i]    = mysql_query("SELECT * FROM $sub[$i] $query_ext");
  
$countsub[$i]   = mysql_num_rows($datasub[$i]);
    for(
$p=0$p<$countsub[$i]; $p++)
   {
       
$rij mysql_fetch_object($datasub[$i]);         
  echo 
$rij->$show[$i];
  echo 
$rij->$idvar[$i];"<br>";

//
// Here is where I ended...it's a mess!
// How to do this?
//

   
}
 }

// einde menubuilder
 
}
 else
 {
// Alternatief menu
 
}



I hope you know a better way doing this. I start making level one, but the next levels...they will be the problem.
Thanks.

Max

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Building DHTML menu with PHP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap