Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function publish_cat_index(){
- global $display_product_nav,$jc_bottom,$display_prod_index_breadcrumb,$display_you_are_here_crumb;
- $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);
- $relationship_sql = "SELECT * from subcategory_relationship";
- $relationship_results = db_query($relationship_sql, db_user, db_pw, database);
- $r_idx = 0;
- if ($relationship_results)
- {
- while ($relationship_row = mysql_fetch_assoc($relationship_results))
- {
- $r_parent = $relationship_row['parent_subcategory_id'];
- $r_child = $relationship_row['child_subcategory_id'];
- $relat_parents[$r_parent] = true;
- $relat_children[$r_child] = true;
- $relationships[$r_idx] = $relationship_row;
- $r_idx++;
- }
- }
- $num_rows = mysql_numrows($result);
- $i = 0;
- $cat_counter = 0;
- $sub_counter = 0;
- $subs_per_row = 4;
- while($i <= $num_rows)
- {
- $row = mysql_fetch_array($result);
- if(!$category_flag[$row["catid"]])
- {
- $category_link = '/our_products/cat_' . $row["catid"] . '.html';
- $breadcrumbs = $display_you_are_here_crumb . " <a href='" . http_root . "/our_products/index.html'>" . $display_prod_index_breadcrumb . "</a> » " . htmlentities(stripslashes($row["category_name"]),ENT_QUOTES);
- if($last_id != $row["catid"] && $last_id != ""){
- $display_cat_index .= "</table></td> </tr> </table>";
- // (Old Stuff)
- // $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>";
- if($category_status[$last_id] == 0)
- $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;
- $write_cat_index = top($pagetitle, "/our_products/cat_" . $last_id . ".html") . $display_product_nav . $display_cat_index . $jc_bottom;
- $cat_fp = include_path . "/our_products/cat_" . $last_id . ".html";
- write_page($cat_fp, $write_cat_index);
- echo small_font . $cat_fp . " page has been published." . close_font . "<BR>";
- flush();
- $display_cat_index = "";
- $write_cat_index = "";
- $sub_counter = 0;
- }
- $cat_counter++;
- $category_flag[$row["catid"]] = $row["catid"];
- $cat_description = nl2br(stripslashes($row["category_description"]));
- $cat_description=ereg_replace('>', '>', $cat_description);
- $cat_description=ereg_replace('<', '<', $cat_description);
- $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'>";
- //put in the optimal page titles for SEO
- if($row["category_name"] == "Packaging Tape"){
- $pagetitle = "Packaging Tape | Box Sealing Tape : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Poly Bags"){
- $pagetitle = "Poly Bags | Polyethylene Bags | Poly Liners : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Bag Sealers"){
- $pagetitle = "Impulse Heat Sealers | Bag Sealers : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Poly Tubing"){
- $pagetitle = "Poly Tubing | Pink Anti-Static Poly Tubing | Black Poly Tubing : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Dispensers"){
- $pagetitle = "Hand Held Tape Dispensers | Paper Roll Dispensers : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Bubble Material"){
- $pagetitle = "Bubble Wrap Supplies : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Plastic Tubes"){
- $pagetitle = "Clear Plastic Packaging Tubes | Bath Salt Tubes | Clear Plastic Tubes : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Mailing Tubes"){
- $pagetitle = "Mailing Tubes | Shipping Tubes | Kraft Tubes : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Shipping & Packing"){
- $pagetitle = "Shipping & Packaging Supplies : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Clear Boxes & Containers"){
- $pagetitle = "Crystal Clear Boxes & Containers : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Retail Packaging"){
- $pagetitle = "Retail Packaging Supplies : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Industrial Bags & Sheeting"){
- $pagetitle = "Trash Bags | Industrial Bags | Industrial Packaging : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Gift Packaging"){
- $pagetitle = "Gift Packaging Supplies : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Shrink Wrap"){
- $pagetitle = "Shrink Wrap Supplies & Systems : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Ziplock Bags"){
- $pagetitle = "Ziplock Bags | Zipper Bags | Reclosable Bags";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Stationery Boxes"){
- $pagetitle = "Greeting Card Boxes | Stationery Boxes | Gift Boxes : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Corrugated Cartons"){
- $pagetitle = "Corrugated Cartons | Cardboard Boxes : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Die Cut Corrugated"){
- $pagetitle = "Die Cut Corrugated Cartons : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "CD, DVD & Other Media"){
- $pagetitle = "CD, DVD & Other Media : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Mailing Bags & Envelopes"){
- $pagetitle = "Mailing Bags & Envelopes : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Kraft Paper"){
- $pagetitle = "Kraft Paper : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Stretch Film"){
- $pagetitle = "Stretch Film & Stretch Wrap : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Chipboard Cartons"){
- $pagetitle = "Chipboard Cartons : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Papers & Wraps"){
- $pagetitle = "Papers & Wraps : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Loose Fill"){
- $pagetitle = "Loose Fill : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- if($row["category_name"] == "Firestarters"){
- $pagetitle = "Light Your Fire Handmade Fire Starters : JCDanczak";
- $pagekeyword = "testing,keyword,insertion";
- $pagedescription = "Testing Description Insertion";
- }
- //ending the page titles
- if($row["category_image"]){
- //$image_hw = GetImageSize(include_path . cat_imagepath . $row["category_image"]);
- $image_w = 250; //$image_hw[0];
- $image_h = 250; //$image_hw[1];
- $display_cat_image[$row["catid"]] = "<img src='" . http_root . cat_imagepath . $row["category_image"] . "' width='" . $image_w . "' height='" . $image_h . "' alt='" . $row["category_name"] . "'>";
- }
- $display_cat_index .= "<table border='0' cellspacing='0' cellpadding='5' align='center'>";
- $category_flag[$row["catid"]] = $row["catid"];
- }
- if($row["sub_catid"] == $row["catid"] && $row["subcat_status"] == 1 && $row["cat_status"] == 1
- && (!@array_key_exists($row['subcategory_id'], $relat_children)))
- {
- $color_counter[$row["catid"]]++;
- /* if(is_even($color_counter[$row["catid"]]))
- $rowcolor = "D8E7FD";
- else
- $rowcolor = "E5EFFE";
- */
- if ($color_counter[$row["catid"]] % 4 == 0)
- {
- $newrow = "</tr> <tr>";
- }
- else
- {
- $newrow = "";
- }
- $subcat_image = '<img border="0" src="../images/subcats/imagethumb.php?s=' . $row['subcategory_image'] . '&w=115" alt="' . htmlentities(stripslashes($row["subcategory_name"]), ENT_QUOTES) . '">';
- $subcat_link = '/our_products/subcat_' . $row["subcategory_id"] . '.html';
- $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;
- // $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>";
- }
- $last_id = $row["sub_catid"];
- $category_status[$row["catid"]] = $row["cat_status"];
- $i++;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment