|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-08-06 13:52 UTC] zeev at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 04:00:01 2025 UTC |
This function should (and does in 3.0) output * Computers * Desktops * Notebooks * Hand Held * Video Games for and number of levels of Cat/Sub-Categories. In 4.0 the output is * Computers * Video Games This also affects other functions that were built out of code like this. <pre> # -------------------------------------------------------- # # Table structure for table 'category' # CREATE TABLE category ( ID int(5) unsigned DEFAULT '0' NOT NULL auto_increment, Name varchar(255) NOT NULL, Description varchar(255) NOT NULL, ParentID int(5) unsigned DEFAULT '0' NOT NULL, LImage varchar(128), MImage varchar(128), SImage varchar(128), PRIMARY KEY (ID), KEY Description (Description) ); # # Dumping data for table 'category' # INSERT INTO category VALUES( '2', 'Desktops', '', '1', 'DefaultCatLarge.gif', 'DefaultCatMedium.gif', 'DefaultCatSmall.gif'); INSERT INTO category VALUES( '1', 'Computers', '', '0', 'DefaultCatLarge.gif', 'DefaultCatMedium.gif', 'DefaultCatSmall.gif'); INSERT INTO category VALUES( '3', 'Notebooks', '', '1', 'DefaultCatLarge.gif', 'DefaultCatMedium.gif', 'DefaultCatSmall.gif'); INSERT INTO category VALUES( '14', 'Video Games', '', '0', 'DefaultCatLarge.gif', 'DefaultCatMedium.gif', 'DefaultCatSmall.gif'); INSERT INTO category VALUES( '13', 'Hand Held', '', '1', 'DefaultCatLarge.gif', 'DefaultCatMedium.gif', 'DefaultCatSmall.gif'); ################################################################ </pre> <? $CS_HELP_EMAIL="help@127.0.0.1"; $CS_SERVERNAME="127.0.0.1"; $CS_SCRIPTNAME=basename($PHP_SELF); $CS_DBHOST="127.0.0.1"; $CS_DBUSER="blaze"; $CS_DBPASS="johnny"; $CS_DATABASE="test_cs"; $CS_FONTATTRIBUTES=""; function mySiteMap($ShowDescription="",$me=0) { global $CS_SCRIPTNAME,$CS_DBHOST,$CS_DBUSER,$CS_DBPASS global $CS_DATABASE,$CS_FONTATTRIBUTES; global $MSM_QUERY,$IS_SUBMAP; global $final,$CatName,$CatDescription; if(!$MSM_QUERY){ mysql_connect($CS_DBHOST,$CS_DBUSER,$CS_DBPASS); $q=mysql_db_query($CS_DATABASE,"select * from category"); unset($final); while($result=mysql_fetch_object($q)): $final[$result->ParentID][] = $result->ID; $CatName[$result->ID] = $result->Name; $CatDescription[$result->ID] = $result->Description; endwhile; mysql_free_result($q); $MSM_QUERY=1; } if (is_array($final[$me])): echo '<ul>'; print "\n"; while (list(,$child)=each($final[$me])): if($me==0){ // Top Level Category echo '<br><li type=DISC>'; echo '<a href="showMyCats.php3?InID='.$child.'">'.$CatName[$child].'</a>'; echo '</li>'; print "\n"; }else{ // NOT Top Level Category, A Sub Cat echo '<li type=CIRCLE>'; echo '<a href="showMyCats.php3?InID='.$child.'">'.$CatName[$child].'</a>'; echo '</li>'; echo '<br>'; print "\n"; } mySiteMap($ShowDescription,$child); echo ""; endwhile; echo "</ul>\n"; endif; } mySiteMap(); ?>