You are here

function adserve_cache_display_ad in Advertisement 7

Same name and namespace in other branches
  1. 5.2 adcache.inc \adserve_cache_display_ad()
  2. 6.3 adcache.inc \adserve_cache_display_ad()
  3. 6.2 adcache.inc \adserve_cache_display_ad()

Load and display an advertisement directly from the database.

File

./adcache.inc, line 267

Code

function adserve_cache_display_ad($id) {
  static $modules = array();
  $ad = node_load($id);
  if (!isset($modules[$ad->adtype])) {
    $modules[$ad->adtype] = db_query("SELECT filename FROM {system} WHERE name = :name", array(
      ':name' => "ad_{$ad->adtype}",
    ))
      ->fetchField();
  }
  _debug_echo("Ad type '{$ad->adtype}', loading module '" . $modules[$ad->adtype] . "'");
  return module_invoke("ad_{$ad->adtype}", 'display_ad', $ad);
}