Remote Ad Code Not Working
bevinlorenzo - August 12, 2009 - 21:46
| Project: | Advertisement |
| Version: | 6.x-2.1 |
| Component: | ad_remote module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
So this may be an amateur issue, but I am not quite sure how this code is intended to work. I have tried embedding the following code on several different sites/platforms with no luck:
<!--start-->
<script language='JavaScript' type='text/javascript'>
var adurl = window.location.href;
document.write(
<div class="advertisement group-tids-1" id="group-id-tids-1">"<scr" + "ipt type='text/javascript' src='http://mysite.com/sites/all/modules/ad/serve.php?q=1&k=2d6924dd26cd7084f3496da73d7787ac&t=1&u="+adurl+"'>"+"</scr" + "ipt>"</div>
)
</script>
<!--end-->Here is my firebug error:
invalid XML tag syntax
[Break on this error] "+""
Any ideas what is wrong with the generated code snippet just by looking at it? Thanks in advance for your help.

#1
So I played with the code snippet a bit and change it to this:
<!--start--><script language='JavaScript' type='text/javascript'>
var adurl = window.location.href;
document.write(
'<div class="advertisement group-tids-1" id="group-id-tids-1"><scr' + 'ipt type="text/javascript" src="http://mysite.com/sites/all/modules/ad/serve.php?q=1&k=2d6924dd26cd7084f3496da73d7787ac&t=1&u='+adurl+'">'+'</scr' + 'ipt></div>')
</script>
<!--end-->
This code works fine, but the Snippet generated in my last post is wrong. It looks like there are some confused double and single quotes...Anyway to update the syntax output of the remote_ad snippets? Or am I just doing something wrong here?
#2
I tried a quick test locally last night, and agree it currently seems broken. Your changes were adding new single quotes around the snippet, and converting a pair of the double quotes to single quotes? Is that correct.
Ideally it would be great if you can submit a patch. Either way, I'll try and retest with these changes soon. Thanks for the feedback.
#3
Ok, so the previous code works in my local environment perfectly, but not on blogger using the custom JS/HTML Widget... Any idea why?
#4
I finally got this embed code to work on blogger:
<!--start--><script language='JavaScript' type='text/javascript'>
var adurl = window.location.href;
document.write(
'<div class="advertisement group-tids-1" id="group-id-tids-1"><script type="text/javascript" src="http://mysite.com/sites/all/modules/ad/serve.php?q=1&k=2d6924dd26cd7084f3496da73d7787ac&t=1&u='+adurl+'">'+'<\/scr' + 'ipt></div>')
</script>
<!--end-->
You'll notice I added a "\" before the forward slash in the closing "script" tag. It also had a hard time interpreting the broken scr'+'ipt so I removed the '+'. I am getting closer, but it still wont work on a drupal page using Full HTML. I want to nail this down before diving into the module code and creating a patch.
#5
Any luck with this?
#6
Following the wisdom in Post #4 by bevinlorenzo 'solved' the problem for me, in that the javascript can be massaged to work properly. However, in the event that someone other than a programmer is generating and distributing the tags, it would be absolutely lovely if the module could output the correct code properly without human intervention.
#7
Is anyone working on this output issue??
#8
Is anyone else getting a bum value for u?
I don't think 'admin%2Fcontent%2Fad%2Fad_remote' is correct.
<!--start--><script language='JavaScript' type='text/javascript'>
var adurl = window.location.href;
document.write(
<div class="advertisement group-tids-291" id="group-id-tids-291">"<scr" + "ipt type='text/javascript' src='http://registermedia.sanduskyregister.com/sites/registermedia.sanduskyregister.com/modules/contrib/ad/serve.php?q=1&k=a3dfca42b9b52c87e9aefbaa166b48d6&c=file&f=5&p=files%2Fregistermedia&t=291&u=admin%2Fcontent%2Fad%2Fad_remote'>"+"</scr" + "ipt>"</div>
)
</script>
<!--end-->
#9
Here is the code that I was able to get functional:
document.write('<div class="advertisement group-tids-3" id="group-id-tids-3"><script type="text/javascript" src="http://XXXXXX/sites/all/modules/ad/serve.php?q=1&k=XXXXXXXX&t=3&u=admin%2Fcontent%2Fad%2Fad_remote"><\/script></div>')