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.
Comments
Comment #1
bevinlorenzo commentedSo I played with the code snippet a bit and change it to this:
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?
Comment #2
jeremy commentedI 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.
Comment #3
bevinlorenzo commentedOk, so the previous code works in my local environment perfectly, but not on blogger using the custom JS/HTML Widget... Any idea why?
Comment #4
bevinlorenzo commentedI finally got this embed code to work on blogger:
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.
Comment #5
jeremy commentedAny luck with this?
Comment #6
btrump commentedFollowing 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.
Comment #7
inteldesk commentedIs anyone working on this output issue??
Comment #8
dallen commentedIs anyone else getting a bum value for u?
I don't think 'admin%2Fcontent%2Fad%2Fad_remote' is correct.
Comment #9
makotec commentedHere is the code that I was able to get functional:
Comment #10
Daryljames commentedI am willing to pay $50 USD to anyone that can provide a working patch to make this work correctly...
Comment #11
reikiman commentedI have a patch which works for me. An additional thing I had to do was to add the img tag to the allowed tags in filtered HTML so that images in HTML ads would be shown.
I wanted to keep the changes inside the ad_remote module. Some of the change could be done in the ad() function rather than here.
I'm unsure in this code what the u= parameter is supposed to be doing. The substitution for 'u="+adurl+"' doesn't appear to be happening.
Comment #12
reikiman commentedUpdated status - the above patch needs review
Comment #13
JurgN commentedI've just tried to use remote ads with the changes in #11 adremote.diff and it seems to work fine! :)
Comment #14
drjonez commentedApplication of above patch solved the problem. (!)
Comment #15
Anonymous (not verified) commented-
Comment #16
drplthis work fine, and to solve 'u="+adurl+"' I change this line to
Comment #17
Anonymous (not verified) commented-
Comment #18
lawrence commentedAlthough this may be redundant, this is a great module and not everyone has patching access or knows how to use them at all. I find this module extremely useful for keeping ads hosted on one domain, and having snippets on your other websites.
To those that don't know how to patch, do the following.
1. Download the following file. - HERE
2. Go to sites/all/modules/ad/remote/ and replace the file you've just downloaded. The file name is ad_remote.module.
3. Always safe to run update.php.
To those code hackers who would rather modify code from the file, do the following.
1. Navigate to sites/all/modules/ad/remote/
2. Open ad_remote.module.
3. Delete everything in there, and replace with the following code.
4. Run update.php, as that should be common practice with every module update.
After you're done, you should be able to run ads from one central domain or heck, start your own ad service if you want. I've attacked the entire module for convenience to those that would rather start from scratch, or just starting.
Jeremy, you've created a powerful module. Thanks for everything. The patch works like a charm by the way. Tested and no errors.
Comment #19
anonymous07 commentedSubscribe
Comment #20
anonymous07 commented@Lawrence: Thank you for the patch!!
I tried to test your method but I am still not seeing the "remote" ads.(I copy/pasted the code you provided directly into the ad_remote.module file).Any troubleshooting recommendations? ThanksUPDATE: Resolved! Had to create an Input Filter on the "remote" site (the one displaying the ads) that had NOTHING checked ... I mean nothing -- no HTML Corrector, no Smileys, no Recaptcha etc.
@Jeremy: This module is looking better and better ... if only I could use Node_Import to bring the Ads in to the "repository" site containing the Ads (and set the Publish/Unpublish Dates and Ad Status during the import without a lot of programming) ... I would deploy this on a bunch of sites. I had to "roll my own" to do this type of thing, but not even close to as feature-rich as this module is.
Keep up the fabulous work because I know this wasn't easy. Cheers!
Comment #21
eric.chenchao commented@Lawrence thanks for your patch and hope it can be committed soon
Comment #22
anonymous07 commented@John Franklin or Jeremy: Could you please consider committing Lawrence's patch in #18 above?
I had to reapply it to get new remote ad groups to show after upgrading to the March 25, 2011 6.x-2.x-dev build.
I can confirm that it works (tested across multiple sites). It appears that "CityReader" above has also used it.
Comment #23
salientknight commentedThe Patch for this error works.
Comment #24
jonathan_hunt commentedI found that the code snippet offered by ad_remote didn't work. It caused a js error on my site apparently caused by quoting issues. Also, u=admin/content/ad/ad_remote wasn't being substituted because it had already be urlencoded.
The above works for me, but I notice that impressions aren't being recorded, only clicks.
Comment #25
lrwebks commentedDrupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!