You are here

function adserve_ad in Advertisement 5.2

Same name and namespace in other branches
  1. 5 adserve.inc \adserve_ad()
  2. 6.3 adserve.inc \adserve_ad()
  3. 6 adserve.inc \adserve_ad()
  4. 6.2 adserve.inc \adserve_ad()
  5. 7 adserve.inc \adserve_ad()

The main adserve logic.

2 calls to adserve_ad()
ad in ./ad.module
Use this function to display ads from a specified group.
serve.php in ./serve.php

File

./adserve.inc, line 22

Code

function adserve_ad($options = array()) {
  static $displayed_count = 0;

  // if no $options are passed in, assume we're using javascript
  if (!empty($options)) {
    adserve_variable('variable_load', $options);
  }
  else {
    adserve_variable('variable_load');
  }

  // include Drupal's settings.php
  adserve_bootstrap(0);

  // if debug enabled, dump state
  adserve_debug();

  // start with 'error' set to false
  adserve_variable('error', FALSE);

  // invoke cache function (file already included in adserve_variable)
  $ids = adserve_cache('get_ad_ids');

  // display the advertisement(s)
  adserve_cache('display', $ids);
}