function ad_display_image in Advertisement 6
Same name and namespace in other branches
- 5.2 ad.module \ad_display_image()
- 5 ad.module \ad_display_image()
- 6.3 ad.module \ad_display_image()
- 6.2 ad.module \ad_display_image()
- 7 ad.module \ad_display_image()
Builds the necessary HTML to display an image-based impressions counter.
1 call to ad_display_image()
- adserve_ad in ./
adserve.inc - The main adserve logic.
File
- ./
ad.module, line 1460 - An advertising system for Drupal powered websites.
Code
function ad_display_image($ad, $css = TRUE) {
global $base_url;
$adserve = variable_get('adserve', '');
$cache = variable_get('ad_cache', 'none');
$variables = "?o=image";
if (is_object($ad)) {
$aid = $ad->aid;
}
else {
/**
* No ad is specified, so we're just tracking traffic.
*/
$aid = 0;
}
$variables .= "&a={$aid}";
if ($cache != 'none') {
$variables .= '&c=' . $cache . module_invoke('ad_cache_' . $cache, 'adcacheapi', 'display_variables', array());
}
$output = '<img src="' . url($base_url . '/' . $adserve . $variables) . '" height="0" width="0" alt="view counter" />';
if ($css) {
return '<div class="ad-image-counter">' . $output . '</div>';
}
else {
return $output;
}
}