function theme_ad_display in Advertisement 6
Same name and namespace in other branches
- 5.2 ad.module \theme_ad_display()
- 5 ad.module \theme_ad_display()
- 6.3 client/ad_client.module \theme_ad_display()
- 6.2 ad.module \theme_ad_display()
- 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()
File
- ./
ad.module, line 190 - An advertising system for Drupal powered websites.
Code
function theme_ad_display($group, $display, $method = 'javascript') {
static $id = 0;
// Increment counter for displaying multiple advertisements on the page.
$id++;
// 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');
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 {
return "\n<div class=\"advertisement group-{$group}\" id=\"group-id-{$group}\">{$display}</div>\n";
}
}