Guest User

Untitled

a guest
Jan 12th, 2018
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.61 KB | None | 0 0
  1. <?
  2. function publish_cat_index(){
  3. global $display_product_nav,$jc_bottom,$display_prod_index_breadcrumb,$display_you_are_here_crumb;
  4.  
  5. $result = db_query("SELECT categories.category_name, categories.category_id AS catid, categories.category_image, categories.category_description, categories.status AS cat_status, sub_categories.subcategory_id, sub_categories.category_id AS sub_catid, sub_categories.subcategory_name, sub_categories.subcategory_image, sub_categories.subcategory_description, sub_categories.status AS subcat_status FROM categories, sub_categories WHERE sub_categories.category_id = categories.category_id ORDER BY categories.sort_order, sub_categories.sort, sub_categories.subcategory_id",db_user,db_pw,database);
  6.  
  7. $relationship_sql = "SELECT * from subcategory_relationship";
  8. $relationship_results = db_query($relationship_sql, db_user, db_pw, database);
  9.  
  10. $r_idx = 0;
  11. if ($relationship_results)
  12. {
  13. while ($relationship_row = mysql_fetch_assoc($relationship_results))
  14. {
  15. $r_parent = $relationship_row['parent_subcategory_id'];
  16. $r_child = $relationship_row['child_subcategory_id'];
  17.  
  18. $relat_parents[$r_parent] = true;
  19. $relat_children[$r_child] = true;
  20.  
  21. $relationships[$r_idx] = $relationship_row;
  22. $r_idx++;
  23. }
  24. }
  25. $num_rows = mysql_numrows($result);
  26. $i = 0;
  27. $cat_counter = 0;
  28.  
  29. $sub_counter = 0;
  30. $subs_per_row = 4;
  31. while($i <= $num_rows)
  32. {
  33. $row = mysql_fetch_array($result);
  34. if(!$category_flag[$row["catid"]])
  35. {
  36. $category_link = '/our_products/cat_' . $row["catid"] . '.html';
  37. $breadcrumbs = $display_you_are_here_crumb . " <a href='" . http_root . "/our_products/index.html'>" . $display_prod_index_breadcrumb . "</a> &raquo; " . htmlentities(stripslashes($row["category_name"]),ENT_QUOTES);
  38. if($last_id != $row["catid"] && $last_id != ""){
  39. $display_cat_index .= "</table></td> </tr> </table>";
  40. // (Old Stuff)
  41. // $display_cat_index .= "</table> </td> <td width='3'><img src='/images/spacer.gif' height='1' width='3' alt=''></td><td width='2' bgcolor='0B326B'><img src='/images/spacer.gif' height='1' width='2' alt=''></td><td width='3'><img src='/images/spacer.gif' height='1' width='3' alt=''></td><td class='body' valign='top'>" . $display_cat_image[$last_id] . "<BR>$cat_description</td></tr></table>";
  42.  
  43. if($category_status[$last_id] == 0)
  44. $display_cat_index = "<h1>This Category Is No Longer Available</h1>" . body_font . "This category is no longer available in our online catalog. If you feel that you have reached this page in error, you may call our customer service department at 1-800-225-7960 or email us at <a href='mailto:[email protected]'>[email protected]</a>" . close_font;
  45.  
  46. $write_cat_index = top($pagetitle, "/our_products/cat_" . $last_id . ".html") . $display_product_nav . $display_cat_index . $jc_bottom;
  47. $cat_fp = include_path . "/our_products/cat_" . $last_id . ".html";
  48. write_page($cat_fp, $write_cat_index);
  49. echo small_font . $cat_fp . " page has been published." . close_font . "<BR>";
  50. flush();
  51. $display_cat_index = "";
  52. $write_cat_index = "";
  53. $sub_counter = 0;
  54. }
  55.  
  56. $cat_counter++;
  57. $category_flag[$row["catid"]] = $row["catid"];
  58. $cat_description = nl2br(stripslashes($row["category_description"]));
  59. $cat_description=ereg_replace('>', '>', $cat_description);
  60. $cat_description=ereg_replace('<', '<', $cat_description);
  61.  
  62. $display_cat_index .= small_font . $breadcrumbs . close_font ."<BR><BR><table width='741' border='0' cellspacing='0' cellpadding='0'><tr><td colspan='5'><h1>".htmlentities(stripslashes($row["category_name"]), ENT_QUOTES)."</h1></td></tr><tr> <td colspan='4'> <div class='body'>$cat_description <br /> <br /></div> </td> </tr><tr><td valign='top' width='290'>";
  63.  
  64. //put in the optimal page titles for SEO
  65.  
  66. if($row["category_name"] == "Packaging Tape"){
  67. $pagetitle = "Packaging Tape | Box Sealing Tape : JCDanczak";
  68. $pagekeyword = "testing,keyword,insertion";
  69. $pagedescription = "Testing Description Insertion";
  70. }
  71. if($row["category_name"] == "Poly Bags"){
  72. $pagetitle = "Poly Bags | Polyethylene Bags | Poly Liners : JCDanczak";
  73. $pagekeyword = "testing,keyword,insertion";
  74. $pagedescription = "Testing Description Insertion";
  75. }
  76. if($row["category_name"] == "Bag Sealers"){
  77. $pagetitle = "Impulse Heat Sealers | Bag Sealers : JCDanczak";
  78. $pagekeyword = "testing,keyword,insertion";
  79. $pagedescription = "Testing Description Insertion";
  80. }
  81. if($row["category_name"] == "Poly Tubing"){
  82. $pagetitle = "Poly Tubing | Pink Anti-Static Poly Tubing | Black Poly Tubing : JCDanczak";
  83. $pagekeyword = "testing,keyword,insertion";
  84. $pagedescription = "Testing Description Insertion";
  85. }
  86. if($row["category_name"] == "Dispensers"){
  87. $pagetitle = "Hand Held Tape Dispensers | Paper Roll Dispensers : JCDanczak";
  88. $pagekeyword = "testing,keyword,insertion";
  89. $pagedescription = "Testing Description Insertion";
  90. }
  91. if($row["category_name"] == "Bubble Material"){
  92. $pagetitle = "Bubble Wrap Supplies : JCDanczak";
  93. $pagekeyword = "testing,keyword,insertion";
  94. $pagedescription = "Testing Description Insertion";
  95. }
  96. if($row["category_name"] == "Plastic Tubes"){
  97. $pagetitle = "Clear Plastic Packaging Tubes | Bath Salt Tubes | Clear Plastic Tubes : JCDanczak";
  98. $pagekeyword = "testing,keyword,insertion";
  99. $pagedescription = "Testing Description Insertion";
  100. }
  101. if($row["category_name"] == "Mailing Tubes"){
  102. $pagetitle = "Mailing Tubes | Shipping Tubes | Kraft Tubes : JCDanczak";
  103. $pagekeyword = "testing,keyword,insertion";
  104. $pagedescription = "Testing Description Insertion";
  105. }
  106. if($row["category_name"] == "Shipping & Packing"){
  107. $pagetitle = "Shipping & Packaging Supplies : JCDanczak";
  108. $pagekeyword = "testing,keyword,insertion";
  109. $pagedescription = "Testing Description Insertion";
  110. }
  111. if($row["category_name"] == "Clear Boxes & Containers"){
  112. $pagetitle = "Crystal Clear Boxes & Containers : JCDanczak";
  113. $pagekeyword = "testing,keyword,insertion";
  114. $pagedescription = "Testing Description Insertion";
  115. }
  116. if($row["category_name"] == "Retail Packaging"){
  117. $pagetitle = "Retail Packaging Supplies : JCDanczak";
  118. $pagekeyword = "testing,keyword,insertion";
  119. $pagedescription = "Testing Description Insertion";
  120. }
  121. if($row["category_name"] == "Industrial Bags & Sheeting"){
  122. $pagetitle = "Trash Bags | Industrial Bags | Industrial Packaging : JCDanczak";
  123. $pagekeyword = "testing,keyword,insertion";
  124. $pagedescription = "Testing Description Insertion";
  125. }
  126. if($row["category_name"] == "Gift Packaging"){
  127. $pagetitle = "Gift Packaging Supplies : JCDanczak";
  128. $pagekeyword = "testing,keyword,insertion";
  129. $pagedescription = "Testing Description Insertion";
  130. }
  131. if($row["category_name"] == "Shrink Wrap"){
  132. $pagetitle = "Shrink Wrap Supplies & Systems : JCDanczak";
  133. $pagekeyword = "testing,keyword,insertion";
  134. $pagedescription = "Testing Description Insertion";
  135. }
  136. if($row["category_name"] == "Ziplock Bags"){
  137. $pagetitle = "Ziplock Bags | Zipper Bags | Reclosable Bags";
  138. $pagekeyword = "testing,keyword,insertion";
  139. $pagedescription = "Testing Description Insertion";
  140. }
  141. if($row["category_name"] == "Stationery Boxes"){
  142. $pagetitle = "Greeting Card Boxes | Stationery Boxes | Gift Boxes : JCDanczak";
  143. $pagekeyword = "testing,keyword,insertion";
  144. $pagedescription = "Testing Description Insertion";
  145. }
  146. if($row["category_name"] == "Corrugated Cartons"){
  147. $pagetitle = "Corrugated Cartons | Cardboard Boxes : JCDanczak";
  148. $pagekeyword = "testing,keyword,insertion";
  149. $pagedescription = "Testing Description Insertion";
  150. }
  151. if($row["category_name"] == "Die Cut Corrugated"){
  152. $pagetitle = "Die Cut Corrugated Cartons : JCDanczak";
  153. $pagekeyword = "testing,keyword,insertion";
  154. $pagedescription = "Testing Description Insertion";
  155. }
  156. if($row["category_name"] == "CD, DVD & Other Media"){
  157. $pagetitle = "CD, DVD & Other Media : JCDanczak";
  158. $pagekeyword = "testing,keyword,insertion";
  159. $pagedescription = "Testing Description Insertion";
  160. }
  161. if($row["category_name"] == "Mailing Bags & Envelopes"){
  162. $pagetitle = "Mailing Bags & Envelopes : JCDanczak";
  163. $pagekeyword = "testing,keyword,insertion";
  164. $pagedescription = "Testing Description Insertion";
  165. }
  166. if($row["category_name"] == "Kraft Paper"){
  167. $pagetitle = "Kraft Paper : JCDanczak";
  168. $pagekeyword = "testing,keyword,insertion";
  169. $pagedescription = "Testing Description Insertion";
  170. }
  171. if($row["category_name"] == "Stretch Film"){
  172. $pagetitle = "Stretch Film & Stretch Wrap : JCDanczak";
  173. $pagekeyword = "testing,keyword,insertion";
  174. $pagedescription = "Testing Description Insertion";
  175. }
  176. if($row["category_name"] == "Chipboard Cartons"){
  177. $pagetitle = "Chipboard Cartons : JCDanczak";
  178. $pagekeyword = "testing,keyword,insertion";
  179. $pagedescription = "Testing Description Insertion";
  180. }
  181. if($row["category_name"] == "Papers & Wraps"){
  182. $pagetitle = "Papers & Wraps : JCDanczak";
  183. $pagekeyword = "testing,keyword,insertion";
  184. $pagedescription = "Testing Description Insertion";
  185. }
  186. if($row["category_name"] == "Loose Fill"){
  187. $pagetitle = "Loose Fill : JCDanczak";
  188. $pagekeyword = "testing,keyword,insertion";
  189. $pagedescription = "Testing Description Insertion";
  190. }
  191. if($row["category_name"] == "Firestarters"){
  192. $pagetitle = "Light Your Fire Handmade Fire Starters : JCDanczak";
  193. $pagekeyword = "testing,keyword,insertion";
  194. $pagedescription = "Testing Description Insertion";
  195. }
  196. //ending the page titles
  197.  
  198. if($row["category_image"]){
  199. //$image_hw = GetImageSize(include_path . cat_imagepath . $row["category_image"]);
  200. $image_w = 250; //$image_hw[0];
  201. $image_h = 250; //$image_hw[1];
  202. $display_cat_image[$row["catid"]] = "<img src='" . http_root . cat_imagepath . $row["category_image"] . "' width='" . $image_w . "' height='" . $image_h . "' alt='" . $row["category_name"] . "'>";
  203. }
  204. $display_cat_index .= "<table border='0' cellspacing='0' cellpadding='5' align='center'>";
  205.  
  206. $category_flag[$row["catid"]] = $row["catid"];
  207. }
  208.  
  209. if($row["sub_catid"] == $row["catid"] && $row["subcat_status"] == 1 && $row["cat_status"] == 1
  210. && (!@array_key_exists($row['subcategory_id'], $relat_children)))
  211. {
  212. $color_counter[$row["catid"]]++;
  213.  
  214. /* if(is_even($color_counter[$row["catid"]]))
  215. $rowcolor = "D8E7FD";
  216. else
  217. $rowcolor = "E5EFFE";
  218. */
  219.  
  220. if ($color_counter[$row["catid"]] % 4 == 0)
  221. {
  222. $newrow = "</tr> <tr>";
  223. }
  224. else
  225. {
  226. $newrow = "";
  227. }
  228. $subcat_image = '<img border="0" src="../images/subcats/imagethumb.php?s=' . $row['subcategory_image'] . '&w=115" alt="' . htmlentities(stripslashes($row["subcategory_name"]), ENT_QUOTES) . '">';
  229. $subcat_link = '/our_products/subcat_' . $row["subcategory_id"] . '.html';
  230. $display_cat_index .= "<td valign='top' width='275' align='center'>" . body_font . "<a href='" . http_root . "$subcat_link'>" . $subcat_image . '<br />' . htmlentities(stripslashes($row["subcategory_name"]), ENT_QUOTES) . "</a>" . close_font . "</td> " . $newrow;
  231. // $display_cat_index .= "<tr><td valign='top' width='275' bgcolor='$rowcolor'>" . body_font . "<a href='" . http_root . "$subcat_link'>" . htmlentities(stripslashes($row["subcategory_name"]), ENT_QUOTES) . "</a>" . close_font . "</td></tr>";
  232.  
  233. }
  234. $last_id = $row["sub_catid"];
  235. $category_status[$row["catid"]] = $row["cat_status"];
  236. $i++;
  237.  
  238. }
  239. }
  240. ?>
Advertisement
Add Comment
Please, Sign In to add comment