Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: Jak dodac po najechaniu na link podswietlenie?
Forum PHP.pl > Forum > PHP
wozniak
Witam mam taki skrypt ktory wyswietla kategorie i jak zrobic takie cos ze jak sie najedzie na jakas nazwe kat. to ta nazwa sie podswietli na jakis kolor np. na zielony co typu <td bgcolor="jakistam">Nazwa_kat</td>
  1.  <tr>
  2. <td>
  3. <?php
  4. /*
  5.   Dynamic DHTL MenuBar for category listing v 0.2.1
  6.   This is a combination of modified categories.php and
  7.   HV Menu javacript written by Ger Versluis (c) 2000 version 5.411 24 December 2001 (updated Jan 31st, 2003 by Dynamic Drive for Opera7)
  8. * HV Menu found on Dynamic Drive ONLY may be used on both commercial and non 
  9. ommerical sites *
  10. * For info about HV Menu write to menus@burmees.nl
  11.  
  12.   Modifications for osCommerce menuBar_0_2 made by John Guerra 2/9/2003
  13.   oscommerce@apodigm.com
  14. */
  15. define('LEFT_LINK_HEIGHT',15);
  16. define('LEFT_LINK_WIDTH',BOX_WIDTH);
  17.  
  18. $info_box_contents = array();
  19. $info_box_contents[] = array('align' => 'left',
  20.  'text' => BOX_HEADING_CATEGORIES
  21. );
  22. new infoBoxHeading($info_box_contents, true, true);
  23. ?>
  24. <script type='text/javascript'>
  25.  
  26. var LowBgColor='transparent'; // Background color when mouse is not over
  27. var LowSubBgColor='white'; // Background color when mouse is not over on subs
  28. var HighBgColor='transparent'; // Background color when mouse is over
  29. var HighSubBgColor='white'; // Background color when mouse is over on subs
  30. var FontLowColor='black'; // Font color when mouse is not over
  31. var FontSubLowColor='black'; // Font color subs when mouse is not over
  32. var FontHighColor='#6699cc'; // Font color when mouse is over
  33. var FontSubHighColor='#6699cc'; // Font color subs when mouse is over
  34. var BorderColor='transparent'; // Border color
  35. var BorderSubColor='#6699cc'; // Border color for subs
  36. var BorderWidth=1; // Border width
  37. var BorderBtwnElmnts=0; // Border between elements 1 or 0
  38. var FontFamily=\"Verdana, Arial, sans-serif\" // Font family menu items
  39. var FontSize=8; // Font size menu items
  40. var FontBold=0; // Bold menu items 1 or 0
  41. var FontItalic=0; // Italic menu items 1 or 0
  42. var MenuTextCentered='left'; // Item text position 'left', 'center' or 'right'
  43. var MenuCentered='left'; // Menu horizontal position 'left', 'center' or 'right'
  44. var MenuVerticalCentered='top'; // Menu vertical position 'top', 'middle','bottom' or static
  45. var ChildOverlap=.0; // horizontal overlap child/ parent
  46. var ChildVerticalOverlap=.0; // vertical overlap child/ parent
  47. var StartTop=1; // Menu offset x coordinate
  48. var StartLeft=0; // Menu offset y coordinate
  49. var VerCorrect=0; // Multiple frames y correction
  50. var HorCorrect=0; // Multiple frames x correction
  51. var LeftPaddng=2; // Left padding
  52. var TopPaddng=1; // Top padding
  53. var DissapearDelay=500; // delay before menu folds in
  54.  
  55. var FirstLineHorizontal=0; // SET TO 1 FOR HORIZONTAL MENU, 0 FOR VERTICAL
  56. var MenuFramesVertical=1; // Frames in cols or rows 1 or 0
  57. var TakeOverBgColor=1; // Menu frame takes over background color subitem frame
  58. var FirstLineFrame='navig'; // Frame where first level appears
  59. var SecLineFrame='space'; // Frame where sub levels appear
  60. var DocTargetFrame='space'; // Frame where target documents appear
  61. var TargetLoc='MenuBar'; // span id for relative positioning
  62. var HideTop=0; // Hide first level when loading new document 1 or 0
  63. var MenuWrap=1; // enables/ disables menu wrap 1 or 0
  64. var RightToLeft=0; // enables/ disables right to left unfold 1 or 0
  65. var UnfoldsOnClick=0; // Level 1 unfolds onclick/ onmouseover
  66. var WebMasterCheck=0; // menu tree checking on or off 1 or 0
  67. var ShowArrow=1; // Uses arrow gifs when 1
  68. var KeepHilite=1; // Keep selected path highligthed
  69. var Arrws=['<?php echo DIR_WS_IMAGES; ?>tri.gif',5,10,'<?php echo DIR_WS_IMAGES; ?>tridown.gif',10,5,'<?php echo DIR_WS_IMAGES; ?>trileft.gif',5,10]; // Arrow source, width and height
  70.  
  71. function BeforeStart(){return}
  72. function AfterBuild(){return}
  73. function BeforeFirstOpen(){return}
  74. function AfterCloseAll(){return}
  75. function Go(){return}
  76.  
  77. <?php  
  78.  
  79.  $number_top_levels = 0;
  80.  $categories_string='';
  81. $number_top_levels = build_menus(0,'','');
  82. echo 'var NoOffFirstLineMenus= ' . $number_top_levels. ';' ; // Number of first level items
  83. echo $categories_string;
  84.  
  85. function build_menus($currentParID,$menustr,$catstr) {
  86. global $categories_string, $id, $languages_id;
  87. $tmpCount;
  88.  
  89.  $tmpCount = 0;
  90.  $haschildren = 0; //default
  91.  
  92. // BOF Enable - Disable Categories Contribution-------------------------------------- 
  93. // BOF Original line
  94.  $categories_query_catmenu = tep_db_query(&#092;"select c.categories_id, cd.categories_name, c.parent_id from \" . TABLE_CATEGORIES . \" c, \" . TABLE_CATEGORIES_DESCRIPTION . \" cd where c.parent_id = '\" . $currentParID . \"' and c.categories_id = cd.categories_id and cd.language_id='\" . $languages_id .\"' order by sort_order, cd.categories_name\");
  95. // EOF Original line
  96.  
  97. // BOF Enable - Disable Categories
  98. //  $categories_query_catmenu = tep_db_query(\"select c.categories_id, cd.categories_name, c.parent_id from \" . TABLE_CATEGORIES . \" c, \" . TABLE_CATEGORIES_DESCRIPTION . \" cd where c.categories_status = '1' and c.parent_id = '\" . $currentParID . \"' and c.categories_id = cd.categories_id and cd.language_id='\" . $languages_id .\"' order by sort_order, cd.categories_name\");
  99. // EOF Enable - Disable Categories
  100. // EOF Enable - Disable Categories Contribution-------------------------------------- 
  101.  
  102.  
  103.  while ($categories = tep_db_fetch_array($categories_query_catmenu)) {
  104.  $tmpString = '';
  105.  $tmpCount += 1;
  106.  $haschildren=tep_has_category_subcategories($categories['categories_id']);
  107.  
  108.  if ($haschildren) {
  109.  if($menustr != ''){
  110.  $menu_tmp = $menustr . '_' . $tmpCount;
  111.  } else {
  112.  $menu_tmp = $tmpCount;
  113.  }
  114.  if($catstr != ''){
  115.  $cat_tmp = $catstr . '_' . $categories['categories_id'];
  116.  } else {
  117.  $cat_tmp = $categories['categories_id'];
  118.  }
  119.  $NumChildren = build_menus($categories['categories_id'],$menu_tmp,$cat_tmp);  } else {
  120.  $NumChildren = 0; 
  121. }
  122.  
  123. if ($id==$categories['categories_id']) {
  124. $tmpString .= '<b>';
  125. }
  126. // display category name
  127. $tmpString .= $categories['categories_name'];
  128.  
  129. if ( $id==$categories['categories_id'] ) {
  130. $tmpString .= '</b>';
  131. }
  132. if (SHOW_COUNTS == 'true') {
  133. $products_in_category = tep_count_products_in_category($categories['categories_id']);
  134. if ($products_in_category > 0) {
  135. $tmpString .= ' (' . $products_in_category . ')';
  136. }
  137. }
  138.  
  139.  if($catstr != ''){
  140. $cPath_new = 'cPath=' . $catstr . '_' . $categories['categories_id'];
  141.  } else {
  142. $cPath_new = 'cPath=' . $categories['categories_id'];
  143.  }
  144.  
  145. // Menu tree
  146. // Menu1_1_1=new Array(Text to show, Link, background image (optional), number of sub elements, height, width);
  147.  if($menustr != ''){
  148.  $menu_tmp = $menustr . '_' . $tmpCount;
  149.  } else {
  150.  $menu_tmp = $tmpCount;
  151.  }
  152. $categories_string .= 'Menu' . ($menustr!=''?$menustr.'_':'') . $tmpCount;
  153. $categories_string .= '= new Array(\"' . $tmpString . '\",\"';
  154. $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new);
  155. $categories_string .= '\",\"\",' ;
  156. $categories_string .= $NumChildren;
  157. $categories_string .= ',' . LEFT_LINK_HEIGHT . ',' . LEFT_LINK_WIDTH ;
  158. $categories_string .= '); ';
  159.  
  160. }// end while
  161. return $tmpCount;
  162. } //end build menus
  163.  
  164. echo '</script>';
  165.  
  166. $tabletext =&#092;"<table><tr><td><div id='MenuBar' style='position:relative; width: \" . LEFT_LINK_WIDTH . \"; height: \" . ($number_top_levels*LEFT_LINK_HEIGHT) . \";'>&nbsp;</div></td></tr></table>\";
  167.  
  168. $info_box_contents = array();
  169. $info_box_contents[] = array('align' => 'left',
  170.  'text' => $tabletext
  171. );
  172.  new infoBox($info_box_contents);
  173.  
  174.  
  175. ?>
  176. <script LANGUAGE=\"JavaScript1.2\" SRC=\"includes/menu_animation.js\"></SCRIPT>
  177.  
  178.  </td>
  179. </tr>
  180. <!-- categories_eof //-->
rzseattle
1. Nie to forum
2. Po co wklejac caly skrypt php skoro tu chodzi tylko o output.

Zamykam.

Prosze autora o zastanowienie na ktorym forum ma napisac i jak ZNACZACO skrocic swoj post.
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.