Results 1 to 3 of 3

Conditional formatting in header.php file

This is a discussion on Conditional formatting in header.php file within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi! I want to put some code in the header.php to do some conditional formatting based on Category. Is that ...

      
  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    35
    Rep Power
    0


    Default Conditional formatting in header.php file

    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!!

  2. #2
    New Member
    Join Date
    Jul 2004
    Location
    a mountaintop in Florida
    Posts
    22
    Rep Power
    0


    Default

    The categories are passed along the URL with the name cPath, and the value is the same as the category id that's set in the database. You can do what you're trying to do like this:
    Code:
    if (isset($HTTP_GET_VARS['cPath'])) {
        $cPath = $HTTP_GET_VARS['cPath'];
            switch ($cPath) {
                case "2" :   // "Ice Cream" id
                    echo "Ice Cream HTML code here";
                    break;
                case "3" :   // "Chili" id
                    echo "Chili HTML code here";
                    break;
                case "6" :   // "Coffee" id
                    echo "Coffee HTML code here";
                    break;
            }
        } else {
            echo "Default HTML code here";
        }
    As always, back up your file first

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    35
    Rep Power
    0


    Default

    THANK YOU, THANK YOU! I could not figure that out!!

Similar Threads

  1. WYSIWYG Newsletter ignores Text formatting?
    By Nocturnaloner in forum osCmax v1.7 Discussion
    Replies: 4
    Last Post: 08-15-2006, 03:30 PM
  2. Conditional Attributes
    By davem in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 07-18-2005, 06:43 AM
  3. Problem with the header.php file
    By emikey24 in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 04-07-2005, 03:43 PM
  4. header / header.php top logo problem
    By the_error_king in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 04-05-2004, 06:02 PM
  5. Need help with my header file..
    By Irata in forum osCommerce 2.2 Installation Help
    Replies: 2
    Last Post: 08-17-2003, 11:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •