If the Ad Module settings are set to display ads using JQuery, the flash ads take over the whole window the website should be occupying. The flash ads work correctly in Javascript and RAW display modes, however. But, I prefer to use the JQuery option for ad display.

Comments

askibinski’s picture

Yes, I can confirm this issue.

Using JQuery can boost page load performance, but it is not compatible with Flash ads. (Flash ad is loaded in whole browser window)

opteronmx’s picture

StatusFileSize
new1.83 KB

At the end, this is caused by the document.write on "AC_RunActiveContent.js" file, because ad_flash.module renders the ad flash as JS instead of HTML, and that's what JQuery expects.

So, to fix this, you can manually edit "theme_ad_flash_swf_render" function (ad_flash.module @ line 570) to use object and/or embed as follows:

function theme_ad_flash_swf_render($ad, $flash) {
		$output = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'. $flash->width .'" height="'. $flash->height .'" id="ad'.$ad->id.'" align="middle">';
		$output .= '<param name="allowScriptAccess" value="sameDomain" />';
		$output .= '<param name="allowFullScreen" value="false" />';
		$output .= '<param name="movie" value="' . $flash->path . '" />';
		$output .= '<param name="quality" value="high" />';
		$output .= '<param name="wmode" value="transparent" />';
		$output .= '<param name="bgcolor" value="#000000" />';
		$output .= '<embed src="' . $flash->path . '" quality="high" wmode="transparent" bgcolor="#000000" width="'. $flash->width .'" height="'. $flash->height .'" name="ad'.$ad->id.'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		$output .= '</object>';
		
    return $output;
}

additionally, I also needed a banner rotator, so I append this code on my document ready

var banners_intID;
if (Drupal.jsEnabled) {
	$(document).ready(function () {
		banners_intID=setInterval('changeBanner()', 30000);
	});
}

function changeBanner() {
	clearInterval(banners_intID);
	$('#banners div.banner').load(Drupal.settings.basePath+'sites/all/modules/ad/serve.php?m=jquery&q=1&t=&u=node&l=node',null,function (responseText, textStatus, XMLHttpRequest) {
		banners_intID=setInterval('changeBanner()', 30000);
	});
}

I didn't tested above code with image or text ads, but in theory must work.

Enjoy

PD:Patch attached

askibinski’s picture

Looks like this works nicely, thanks!

Alex Andrascu’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: Unassigned » Alex Andrascu

Thank you for the patch, nice work.
Please reroll the patch against current HEAD and i'll commit it.
Thanks

Alex Andrascu’s picture

Status: Active » Needs work
gregarios’s picture

Version: 6.x-2.x-dev » 6.x-2.1
Status: Needs work » Active
Alex Andrascu’s picture

will look into it in the next few days
Thanks for the patch

alanburke’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

Re-rolled

Alex Andrascu’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
Status: Needs review » Patch (to be ported)

Patched against latest -dev.
Thanks for the patch and please help me test it.
Alex

gregarios’s picture

Status: Patch (to be ported) » Needs work

Patched against latest -dev.
Thanks for the patch and please help me test it.
Alex

Fantastic! This is the first time I've had the flash ads display correctly using JQuery. Image ads also work well. However, the Flash ads no longer go anywhere when clicked.

By the way, all the ads display about 80% quicker than straight JavaScript on page load using the JQuery method on my site.

UPDATE: Actually the flash ads are no longer clickable in any display mode in this version.

Alex Andrascu’s picture

I guess it's missing the flashvars clickTag param. We'll look into it.

iaminawe’s picture

Can confirm this error. Any solution in sight?

iaminawe’s picture

Sorry I just checked and I am actually only using Javascript as the serving method for my ad but I still get nothing when I click on the ad. I am using the current most recent dev version.

Alex Andrascu’s picture

I just made some fixes against the -dev. Please test.

Alex Andrascu’s picture

Status: Needs work » Needs review
gregarios’s picture

Status: Needs review » Active

No click action still even with the Jan 13 dev. Doesn't matter what display method, the flash ads' link doesn't go anywhere. Again, the ads display quite nicely though.

Here is the output:

<div class="advertisement group-tids-62" id="group-id-2"><div class="flash-advertisement flash-advertisement-swf ad-group-right side 300x250 top" id="ad-15365"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="ad" align="middle" height="250" width="300"><param name="allowScriptAccess" value="sameDomain"><param name="allowFullScreen" value="false"><param name="movie" value="http://kpbj.net/drupalfiles/ads_kitsapcu.org_20091202.swf"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="bgcolor" value="#000000"><param name="flashvars" value="clickTAG=http://kpbj.net/ad/redirect/15365/t62?url=taxonomy/term/15"><embed src="http://kpbj.net/drupalfiles/ads_kitsapcu.org_20091202.swf" quality="high" wmode="transparent" bgcolor="#000000" name="ad" allowscriptaccess="sameDomain" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="250" width="300"></object></div></div>

Upon inspection, the <embed> tag is missing the second needed FlashVars="clickTAG=http%3A//www.thelink.com"

Alex Andrascu’s picture

Can you please post how should the correct object embed code look like?
Never worked with this clickTAG var before :P
Thanks.

gregarios’s picture

Everything seems right, except the <embed> tag. I think it needs to be something like this:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="ad" align="middle" height="250" width="300">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="http://example.com/url/path/to/flashfile.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#000000" />
<param name="flashvars" value="clickTAG=http://click-destination-example-url.net" />
<embed src="http://example.com/url/path/to/flashfile.swf" FlashVars="clickTAG=http%3A//click-destination-example-url.net" quality="high" wmode="transparent" bgcolor="#000000" name="ad" allowscriptaccess="sameDomain" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="250" width="300" />
</object>
Alex Andrascu’s picture

Ok. I'll fix it. Can you please tell me how do you use the jquery display method with flash ad ? I can't seem to figure out. I mean how exactly do you display 2 ads rotating in the same block without refreshig.

gregarios’s picture

You can't rotate several ads in one ad spot unless you use Views. This module will nto be able to get the needed data from the ad module.

Also, forget using the code I gave you in the last post... this is apparently the new standard from what I can tell... I tested it in IE7, IE8, Safari, and Firefox:

<object type="application/x-shockwave-flash" data="http://example.com/url/path/to/flashfile.swf" id="ad" height="250" width="300" >
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="http://example.com/url/path/to/flashfile.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#000000" />
<param name="flashvars" value="clickTAG=http://click-destination-example-url.net" />
</object>

New browsers of the last couple of years have allowed it to be much simpler these days.
No need for the <embed> code at all.
(This also validates correct XHTML Strict!)

gregarios’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

Attached is a patch that can be applied to the Jan 13 dev to accomplish what you need. :-)

Alex Andrascu’s picture

Cool thanks :) I need to look into the image ad module and steal the jquery code from there then. Can you confirm if the image ad work with jquery ?

gregarios’s picture

Cool thanks :) I need to look into the image ad module and steal the jquery code from there then. Can you confirm if the image ad work with jquery ?

What more are you looking for? This module works well after I patched it with my patch. Is there another issue you're trying to fix as well?

Running images via the JQuery display type has always worked and is the job of the Ad module...

Alex Andrascu’s picture

You can't rotate several ads in one ad spot unless you use Views. This module will nto be able to get the needed data from the ad module.

What do you mean it won't be able to get needed data. That's what i'm trying to acomplish.

gregarios’s picture

The Ad module cannot rotate ads except on page reload. There is a module already in developement (Ad Views) to use Views Module to accomplish that. Also, that is a different issue than what we're discussing in this thread.

I wouldn't try to accomplish ad rotation in this module at all... it will just destroy it. Please don't mess with a good thing! :-)

Currently, the Ad module cannot rotate any kind of ad, using any method, without reloading the page.

Will you be able to roll my patch in and make a new release for us? :-)

Alex Andrascu’s picture

I'm not messing with anything lol :) just trying to understand the purpose of the Javascript and Jquery display mode for the Ad module and it seems i can't figure whatsoever :)). Can you try to detail it even further. I swear i won't break anything on the dev :)

JavaScript, jQuery, and IFrame display methods allows you to display random ads and track impressions even on cached pages. When using the Raw display method together with Drupal's page cache, impressions will be properly tracked but advertisements will only change when the page cache is updated.

I guess this is where i'm getting stucked.

gregarios’s picture

On really valuable reason for Javascript and JQuery display mode is that you can use a caching module like Boost Module to static-page-cache your whole site, while still displaying a different ad on each page load. :-) And, with JQuery, even most of the Javascript gets cached as well, allowing just the ad itself to change on a cached site.

Without a remote-retrieving ad script like JQuery/Javascript... a cached page would always show the ad that was visible when the page was cached -- never rotating even on page reloads. With a script in the page, the script gets cached, allowing it to retrieve an uncached ad even when the whole page remains in a fast cached state.

Alex Andrascu’s picture

Ok now i'm getting it :). Thanks alot !!! I am using boost module but not on the same website with advertisment. That's why i didn't bother until now.
Thanks again.

gregarios’s picture

Will you be putting out a 2.2 release with this today? I've been waiting for about a year for this capability lol. :-)

Alex Andrascu’s picture

ROFL...easy with me on stairs...i was just starting to maintain this module like a week ago (after i was waiting one year for someone to do the ad_flash properly so i don't have to). I can't promise today but i'll release the 2.2 by the end of this week. :)

gregarios’s picture

lol ok thanks.

FUNNY to think I was waiting for a maintainer to start working on it, while you were waiting for a web designer to offer up the flash code. (-; We could have had this done a long time ago heheh.

Alex Andrascu’s picture

BTW i'm also much more a designer then a programmer. Was working as a designer for like 10 years now. Started to mess with php sql and the like 3 years ago. Not a guru but i'm not a n00b also and i'm not afraid to wreak havoc on something just to have a good reason to fix it.

Anyways thanks to stick arround and help me with all! You're always welcome.

Alex Andrascu’s picture

Grr!!! This patch's not good. Try to patch it against a -dev version in the same directory. Look at the other patches. For ex. #8.

I guess this line is faulty

diff -upN ../ad_flash.1/ad_flash.module ./ad_flash.module
--- ../ad_flash.1/ad_flash.module 2010-01-13 08:39:00.000000000 -0800
+++ ./ad_flash.module 2010-01-14 10:55:37.000000000 -0800

i don't have any ad_flash.1 dir and the version isn't mentioned anywhere.

gregarios’s picture

You tried it and it didn't work? Or you're looking at the patch and deciding it won't work? :)

I made the patch from the Jan 13 dev. I admit I'm new to patches... but I tried it on a fresh download and it didn't need anything.

Alex Andrascu’s picture

I tried it and it's not working. Look at the patch at #8. What are you patching with ?
The problem is that
--- ../ad_flash.1/ad_flash.module 2010-01-13 08:39:00.000000000 -0800
+++ ./ad_flash.module 2010-01-14 10:55:37.000000000 -0800

I don't have and don't need to have the .1 directory.

Anyway i patched it by hand allready and released 6.x-2.2 :)

gregarios’s picture

StatusFileSize
new1.63 KB

Try this one. Put it in a freshly uncompressed dev version. Then 'cd' into the folder and run:
patch < ad_flash_20100114b.patch

This should work fine.

Alex Andrascu’s picture

That one is looking ok but it's coming too late :))...The new release is up allready. You got the credits anyway :)

Alex Andrascu’s picture

Status: Needs review » Patch (to be ported)
Alex Andrascu’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
Alex Andrascu’s picture

Status: Reviewed & tested by the community » Fixed
gregarios’s picture

Did the changes get in?? Oh... I see they did. THANKS! :-)

Alex Andrascu’s picture

No i just released an old version and tagged it as new for no purpose.
Of course they got in lol.
Cheers! Thank you too.

gregarios’s picture

2.2 Works great! Thanks! :-)

opteronmx’s picture

I just checking status of one of my Drupal sites, and I realized about this new version... I came later to
the party :/ I'm flash developer too.

Anyway, Thanks for the credits and the great work!!!

gregarios’s picture

Hmmm... looking back at opteronmx's code... you may be able to incorporate multiple image rotations without page reloads, but you'd need a few mode administration settings to cover it. That should be started in a completely new issue if it is a goal.

opteronmx’s picture

Yes gregarios, the code I wrote for ad rotation its based on Drupal's and Ad's API, that was the better way I found, but I did it just for one banner instance, not multiple instances, but that's just matter to deal with CSS ids, jQuery and stuff like.

Alex Andrascu’s picture

start a new feature request and let's move there then :)

Alex Andrascu’s picture

Status: Fixed » Closed (fixed)
pravinsaw’s picture

Thanks all,
the discussion is very useful for me. You peoples solve my problem.
Thanks again