function ad_external_display_ad in Advertisement 5
Same name and namespace in other branches
- 5.2 external/ad_external.module \ad_external_display_ad()
- 6.3 external/ad_external.module \ad_external_display_ad()
- 6 external/ad_external.module \ad_external_display_ad()
- 6.2 external/ad_external.module \ad_external_display_ad()
- 7 external/ad_external.module \ad_external_display_ad()
Function used to display the selected ad.
2 calls to ad_external_display_ad()
- ad_external_node_form in external/
ad_external.module - Adapi helper function for displaying a node form.
- ad_external_node_view in external/
ad_external.module
File
- external/
ad_external.module, line 18 - Enhances the ad module to support externally hosted ads, served via IFrames. It is recommended that you configure "Administer >> Content management >> Ads >> Settings >> Global settings >> Display type" to…
Code
function ad_external_display_ad($ad) {
global $base_url;
// For now, we hard code this to only support caching with the file cache.
// As more cache types are introduced, we'll expand this. Ideally it should
// be cache type agnostic, but that seems to be unrealistic.
if (variable_get('ad_cache', 'none') == 'file') {
$adserve = variable_get('adserve', '');
$display_variables .= '&c=file' . module_invoke('ad_cache_file', 'adcacheapi', 'display_variables', array());
$external = url("{$base_url}/{$adserve}?o=external&n={$ad->aid}&{$display_variables}");
}
else {
$external = db_result(db_query('SELECT url FROM {ad_external} WHERE aid = %d', $ad->aid));
}
$append = 'frameborder="' . variable_get('ad_iframe_frameborder', 0) . '" ';
$append .= 'scrolling="' . variable_get('ad_iframe_scroll', 'auto') . '" ';
$append .= "name=\"{$group}\" ";
if ($height = variable_get('ad_iframe_height', '')) {
$append .= "height=\"{$height}\" ";
}
if ($width = variable_get('ad_iframe_width', '')) {
$append .= "width=\"{$width}\" ";
}
return "<div class=\"external-advertisement\" id=\"ad-{$ad->aid}\"><iframe src=\"{$external}\" {$append}></iframe></div>";
}