Tag: OpenAds

How do you pass variables into OpenAds Javascript?

This has been kicking me for the last 12 hours, and based on various help sections and forums which shall not be named, it seems to be causing a bit of trouble for others as well.

I’m working with a modified version of OpenAds. Yes I modified it, but before you say “crap, Gracie modified something…no wonder it’s broken” I’ll just advise you to put a lid on it – the project still works. I’m playing with delivering ads using the remote Javascript, but I’ve got a hitch. Each page I’m trying to deliver a text ad to is a search result that has a keyword associated with it. I’ve passed that keyword onto the page using the variable $tagString – it’s url encoded. I can print that keyword by placing {$tagString} anywhere in the template code. So I know the variable is there.

Now I’m trying to pass $tagString into the chunk of Javascript, and it just isn’t working. I’ve tried different notations such as %24tagString etc., and tried adding things like var tagstring = $tagString at the top, but the Javascript ad code just doesn’t see the variable. In addition, I replaced the variable with an actually keyword string and it returned the correct result so I’m certain it isn’t a server side issue. The ad code is below, and if anyone has any bright ideas they can pass along I would forever be in your debt gladly take you out for a beer someday. I’ll certainly pass this on to the OpenAds community if someone can figure it out. Note: XXX denotes the spot where the variable $tagString is supposed to go.