You are here

function theme_ad_display in Advertisement 5.2

Same name and namespace in other branches
  1. 5 ad.module \theme_ad_display()
  2. 6.3 client/ad_client.module \theme_ad_display()
  3. 6 ad.module \theme_ad_display()
  4. 6.2 ad.module \theme_ad_display()
  5. 7 ad.module \theme_ad_display()

Function to display the actual advertisement to the screen. Wrap it in a theme function to make it possible to customize in your own theme.

1 theme call to theme_ad_display()
ad in ./ad.module
Use this function to display ads from a specified group.

File

./ad.module, line 151
An advertising system for Drupal powered websites.

Code

function theme_ad_display($group, $display, $method = 'javascript') {
  static $id = 0;

  // The naming convention for the id attribute doesn't allow commas.
  $group = preg_replace('/[,]/', '+', $group);
  if ($method == 'jquery') {
    _drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
    return "\n<div class=\"advertisement group-{$group}\" id=\"group-id-{$id}\">\n <script type=\"text/javascript\">\n //<!--[CDATA[\n  \$(document).ready(function(){ jQuery(\"div#group-id-{$id}\").load(\"{$display}\"); });\n //]]>\n </script>\n</div>\n";
  }
  else {
    if ($method == 'raw') {
      return $display;
    }
    else {
      return "\n<div class=\"advertisement group-{$group}\" id=\"group-id-{$group}\">{$display}</div>\n";
    }
  }
}