You are here

function theme_ad_display in Advertisement 7

Same name and namespace in other branches
  1. 5.2 ad.module \theme_ad_display()
  2. 5 ad.module \theme_ad_display()
  3. 6.3 client/ad_client.module \theme_ad_display()
  4. 6 ad.module \theme_ad_display()
  5. 6.2 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 215

Code

function theme_ad_display($variables) {
  static $id = -1;

  // Increment counter for displaying multiple advertisements on the page.
  $id++;

  // The naming convention for the id attribute doesn't allow commas.
  $group = preg_replace('/[,]/', '+', $variables['group']);
  if ($variables['method'] == 'jquery') {
    return "\n<div class=\"advertisement group-{$variables['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 ($variables['method'] == 'raw') {
      return $variables['display'];
    }
    else {
      return "\n<div class=\"advertisement group-{$variables['group']}\" id=\"group-id-{$variables['group']}\">{$variables['display']}</div>\n";
    }
  }
}