I know that to the expert coder, this is probably all a joke, but I hope that this post can save someone a lot of time and frustration. I also want to go ahead and note that I am still using Sunshop version 3.5.1, not any of the new version 4 release candidates as I am waiting for final releases.

Background

Several of my sites are pretty successful, some enough to get some money back using Text Link Ads (TLA). One of these sites has caused me a bit of a headache here recently. Many moons ago, this site was running WordPress and since TLA offers a WordPress plugin, this was a breeze. However, earlier this year, it became a necessity for me to change to something else, to a “full-fledged” shopping cart program. I ended up going with Sunshop. Once I figured out how to edit the templates, I figured I was okay. I kept running into one problem though, how to incorporate my TLA into my new Sunshop sidebar? Everything I tried either gave me crazy PHP errors, or just plain did nothing. After a couple weeks of working on this and other aspects of the site, I finally gave in and emailed TLA from their contact page. I waited for a response, and waited, and waited. Finally I gave up and put the text ads in an iframe, as I didn’t know what else to do at this point, and put my new site into production. That worked and the average visitor couldn’t tell there was an iframe, so I forgot about it.

Fast forward three and a half months. Yesterday evening (Monday), I logged into my ISP’s webmail to check the bulk mail folder and empty it out. I had two emails from TLA that were sent respectively Sunday evening and early Monday. The first told me that my site had been put “on hold” because they had checked and it appeared the link script was not working. I responded to that with a “yu-huh,” a screenshot, information about how I’d asked about this before, and a line about how horrible their customer service is before I saw the second email which read:

Valerie,

As we mentioned yesterday, we have sold ads for your site ([site]), but it looks like the script is not working properly. We could not find the following links:

– [links...]

Please log back into your account and reinstall the code and make sure you follow all of the instructions. This site’s package is still on HOLD for the time being. Your site will be rechecked once more. If the links are found, your site will be automatically enabled again.

Please note the following:

1) It’s possible that these links went undetected due to network issues encountered in reaching your site. If that is the case, they will be found tomorrow when we check your site.

2) If you’ve placed your links using Javascript or iframes, they have been flagged because we do not accept those technologies. The links must be changed to organic links on the actual URL.

3) You may be receiving this email because you have placed the links at a URL other than the one you registered. The links MUST appear at the exact URL: [url]. Other URL’s or redirects are not allowed. If you have changed your URL, please contact us.

Thanks,

Of course, I immediately knew #2 was the issue. So I responded again explaining the situation and how I did the iframes only because no one cared to give me the courtesy of a reply to help me out on this when I emailed about it months ago.

Then Jamie happened to message me online and I told her what was going on. She ended up spending two hours with me, trying to get this to work properly. Thank you, Jamie!

The Fix

So here’s what had to be done to get it working.

When you generate your TLA code, you’re going to tell it PHP, of course. Put that code in a file in the same directory as your Sunshop, or wherever, really, and create the XML file and whatever else TLA tells you to do for that.

In global.php, which is in the main directory of Sunshop, you need to tell it where to find the TLA file. Find a spot to put it above where a template is evaluated. I started mine around line 2592, above this line:

eval("\$main = \"".$templates[main_area]."\";");

Put this there:

ob_start();
if ($success = @include("yourfile.php")) {
$include_ads = ob_get_contents();
} else {
$include_ads= "Could not open file.";
}
ob_end_clean();

Of course, you’ll change “yourfile.php” to be the absolute path to your TLA PHP file. You can also change include_ads to be whatever you want it to be. Make sure it’s the same in both places.

Now, make note of where I put my code in global.php. I put it above the call for the main_area template to be evaluated. Apparently that means that I can only call this new tag inside the main_area template.

So now, in my templates file, in the proper place, I simply put $include_ads and they display! From there on out, it’s CSS and any HTML required to change the look of the links. Since Sunshop 3.5.1 is so table-based (I don’t know how 4 is going to be), I had to add code to my TLA file before and after the link codes to make sure the area displayed just like the rest of the site.

After doing some more looking around and reading, I think there’s another way to do this, but this method seems MUCH easier, and it works!

Update

I just got an email from TLA that my site has been removed from hold. Still no response whatsoever concerning Sunshop or how to incorporate ads or anything. Sheesh, I love TLA, they make me money, but this is ridiculous!