ReginaStelling Posted August 3, 2004 Posted August 3, 2004 Hi! I want to put some code in the header.php to do some conditional formatting based on Category. Is that possible... How can I do this: IF Category = "Ice Cream" then A IF Category = "Chili" then B IF Category = "Coffee" then C Else D I know a little php...but not sure how to check the category. Is that a URL string I should check?? Any help would be GREATLY appreciated!!
Jan Zonjee Posted August 3, 2004 Posted August 3, 2004 I want to put some code in the header.php to do some conditional formatting based on Category. Is that possible... Would something like this work? Cases to be filled according to your shop of course. <?php if (isset($_GET['cPath']) { // if category = cPath is not in the URL, no reason to go further switch ($_GET['cPath']) { case "1_7": print ("<h1>A. This is for Ice Cream</h1>\n"); break; case "2" : print ("<h1>B. This is for Chili</h1>\n"); break; case "4_21" : print ("<h1>C. This is for Coffee</h1>\n"); break; default: print ("<h1>D. None of the above</h1>\n"); } // end switch } // end if (isset(category) ) ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.