Fork me on GitHub

PnBannerDisplay and Theme Logic  Bottom

  • Ok, the pnbanner display function is fine and dandy. You have it turned on and some banners set up, it shows em. If not, they don't show.

    I'm working on a theme where I have a whole new table displayed if there are banners, not just an empty spot that can be filled. I want to incorporate some logic into the theme, where I can check if the banners exist in the first place, and based on that, decide whether or not to load the tables and run pnBannerDisplay.

    something along the lines of "if there are banners, then show this code, run pnBannerdisplay. else, just ignore the whole damn thing and move on"

    What variable(s) and value(s) should I check for in order to accomplish this?[/code]
  • Hi there,

    This is only theory, but you can give it a try (you will need to make sure there are no banners with an ID type <= 1).

    Code

    if (pnConfigGetVar('banners') <= 1) {

    //code

    } else {

    //code

    }

    Hope this helps

    Kindest regards
    Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Actually, I think that will just check to see if you have banner's configured on your website, not if there is a banner to be displayed (some banners might expire in certain zones, etc...).

    You could try something like:

    Code

    $showbanner = pnBannerDisplay(x);
    if (!empty($showbanner)) {
       // Display the banner
       echo $showbanner;
    } else {
        // Display the alternate HTML
    }

    Where "x" in the function call is the number of the zone for the banner in question (or blank if no zones).

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • nate_02631

    Actually, I think that will just check to see if you have banner's configured on your website, not if there is a banner to be displayed (some banners might expire in certain zones, etc...).

    You could try something like:

    Code

    $showbanner = pnBannerDisplay(x);
    if (!empty($showbanner)) {
       // Display the banner
       echo $showbanner;
    } else {
        // Display the alternate HTML
    }

    Where "x" in the function call is the number of the zone for the banner in question (or blank if no zones).


    Yes this looks more promising, Thanks Nate!

    Regards

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment

This list is based on users active over the last 60 minutes.