Purchase OIOpublisher now for just $47.

Take control of your ad space.

Click here to purchase

  1.  

    Hi there,
    I was wondering if it is possible to check if a banner zone is empty. I need to check wether the content of a banner zone equals 0, like this: content == 0. Is there a way to do this?

    My code:

    if(function_exists('oiopub_banner_zone')) {
    global $oiopub_set;
    $zone_id = 1;
    $options = array(
    'markup_zone_tag' => "div",
    'markup_ad_tag' => "div",
    'fluid' => "false",
    'markup_allow_style' => "false",
    'empty' => "0" // This is hiding an empty zone
    );

    // Here i want to check wether the banner zone is empty or not.

    if ( BANNER ZONE IS EMPTY ) {
    SHOW ME: NO PURCHASED AD IN BANNER ZONE

    } else {
    SHOW ME: THERE ARE PURCHASED ADS IN BANNER ZONE

    }

    }

    Thanks for your Support!

    Need help?  Quick start guide | Troubleshooting | All help topics
    • CommentAuthorSimon
    • CommentTimeJun 20th 2015
     
    Project Admin

    You can get the oiopub_banner_zone function to return a string, rather than print the result immediately. You can therefore look for the presence of a tracking link to determine whether there are any purchases in the ad zone.

    $output = oiopub_banner_zone(1, array( 'echo' => false ));
    if(stripos($output, "go.php") !== false) {
    //purchases exist, display zone
    echo $output;
    } else {
    //no purchases exist, do something else
    }

    Need help?  Quick start guide | Troubleshooting | All help topics