Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Simple php question

    I'm trying to add a call in my php to indentify specific categories in order to display a banner. I have like 20 categories to add and I'm having trouble adding these category ID #'s to the code. My question is trying to find a way to add all the categories into the one line of code, rather than copying and pasting the entire block of code 20 times for each category ID.... The spot I want to add multiple ID #'s is in red:

    <?php
    if ($current_category_id == '33'){
    if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
    if ($banner->RecordCount() > 0) {
    ?>
    <div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
    <?php
    }
    }
    }

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Simple php question

    Have a look in your tpl_main_page.php and find this and add your flag condition in place of this one
    Code:
    // the following IF statement can be duplicated/modified as needed to set additional flags
      if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
        $flag_disable_right = true;
      }
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Nov 2008
    Posts
    71
    Plugin Contributions
    0

    Default Re: Simple php question

    Okay. I might be interpreting what you suggested wrongly, but I allready have this code I showed on that tpl_main_page.php, and it is working fine. I just need to add like 20 more category ID's to where the '33' is. Am I missing what you are sayin? Thanks!

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Simple php question

    I just need to add like 20 more category ID's to where the '33' is. Am I missing what you are sayin?
    I suppose so
    list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces
    Code:
    if ($current_category_id == '33,34,35,36,37,etc'){
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Simple php question

    Actually, I think you will find this works a little better with multiple values to check:
    Code:
    if (in_array($current_category_id, array(10,12))) {
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v139h Simple PHP code question
    By DigitalShadow in forum General Questions
    Replies: 4
    Last Post: 26 Feb 2013, 08:13 PM
  2. Simple question for PHP programmers, hard for me!
    By Athens Collectibles in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 23 Mar 2012, 12:08 PM
  3. A simple question for PHP programmers
    By HTMLGoddess in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Jul 2008, 10:59 AM
  4. A simple .php code question? Please help!
    By triplemoonranch in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 24 Feb 2008, 01:55 AM

Posting Permissions

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