I am running WP-SuperCache and a banner ad rotator that is using a simple php call to pull a given banner from ones listed in a text file. The call is made in the header.php file.
I’ve noticed that WP-SuperCache does such a great job at caching that it doesnt really allow my banner rotator to actually randomly rotate. Because WP-SuperCache delivers a static HTML copy of a once-generated page, whatever banner is picked once stays until the cache is cleared.
That’s not great for my advertising efforts. Due to randomness, I noticed some of my banners weren’t even showing at all because it’s a straight 1/5 shot each 100 requests — which might be a half of a day for my site.
I can’t be the only one who wants to both cache the nuts and bolts of the site but still have some ability to let my ads randomly generate.
Don’t use a PHP based rotator, or don’t use Super-Cache.
Sorry, no other solution. The whole point of Super-Cache is to not have any PHP run at all. To make the site static.
Otto, thanks! Any suggestions on a java-based ad rotator? All the ones I can find here are calling PHP. Any downside to using Java besides that a few browsers might have it disabled? I imagine it’s considerably slower than PHP?
I was thinking — can I just try to fit the call in the index template file? After all, that isnt entirely static – it has to display the newest posts? I tried putting one of the PHP calls prior to the get_header function, but although the ads loaded, my sidebars didnt for some reason.
Thanks for your help. You do a lot for the WordPress community and we thank you!
A Super Cached page is *entirely* static. Moving the code around won’t help you a bit.
As far as what one to use, heck, Google for it. There’s millions of them. You can probably write one yourself.
That worked like a charm. Thanks! Here’s the code I ended up using. There’s a lot of others out there, like you said.
Alternatively you could use an iframe to call an ad-page on your server, and then add that url to the exceptions. This is suggested here (although with a different situation and outcome):
In my case I have mixed image and flash banners rotating, so that’s what I’ll do.
the iframe would work with the plugin if i made a wordpress-created page, but the problem with that is that it would load the WHOLE SITE in that iframe to enter the wordpress loop to get that page.
if i make an ads.html file or something outside of wordpress, it would look right, but i’m fairly certain I couldnt then use it to call a wordpress plugin – as the HTML file is outside of wordpress and the call probably wouldnt make any sense to mysql.
here’s my original post on it. if you have any ideas, it would be terrific. lots of people are making pretty decent money on this network so far.. and i’ve love to sign up.
seriously — isnt pretty much everyone running some kind of cache? you think they’d consider that.
Can’t you add the URL to the plugin in the filtered-out URLs in the options of WP-Supercache ?
Quoting the options inside WP Super Cache :
Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it’s enough to specify the year, i.e. ‘/2004/’. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.
I may have understood it wrong of course, but doesn’t that leave open the possibility that some elements inside a cache page will still need to be dynamically loaded, as long as their components depend on a blocked URL ?
sabinou – thanks for the help. unfortunately, i dont think it works like that. supercache can exclude a page (which I interpret to be a page in the WP loop) from being cached, but a direct path to a plugin is not a page in wordpress. the best real-life example i had with that exclusion feature is when I installed a WP-POLL on a certain page in wordpress which I called ‘polls’. I told supercache to exclude it, and voila, even tho the page was only a php call to the plugin, it wasnt cached and the results showed up instantly upon voting. in this situation, the ads section is hard-coded into a sidebar that is shown on every page. in php form, it’s becoming increasingly clear i can’t have the plugin work as-is AND still cache the content around it.
i’ve written them a few emails. hopefully they’ll respond to one of them.
I’d need more information about how PerformancingAds works to give you a better solution. Could you give me a link to the PHP code they use or something?
Okay, using the perfads plugin, you can do this:
1. Make a new PHP file somewhere. Call it “ad.php” or something. Put all the perfads php stuff in that same directory as the ad.php. There’s no need to configure it as a WordPress plugin.
2. Put this in that new ad.php file:
<?php include_once('perfads.php'); perfads(REGION_ID); ?>
Use your region ID, obviously.
Otto, here’s what I’ve experienced so far:
a) the caching doesnt prevent new ads now. that’s terrific! when changing the number of my ads on their site from 2 to 4, it showed instantly on my site.
b) the ads display, but when you click on the ‘advertise here’ button, it loads in the iframe and not in a new page. since there’s no href – is there something i can maybe pop in the php to make the click load in a new page?
c) when i do click in, their site claims I have no regions of which to buy ads. i dont know if this is because of the way that we did the include or if there’s a glitch on their site. the URL generated looks correct compared to other advertisers. i did add the regionID they gave me to the included php. when i tried this a few days ago through the plugin, their site correctly showed the regions available and the cost immediately. i’ll see if this clears up in an hour or so.
either way, i appreciate your help with this. there are others out there that have been trying to get this done outside of the plugin as well, so hopefully we’ll figure something out.
EDIT: as a test i installed the plugin again, put in the region, and clicked through. it DID NOT display the regions/prices correctly, so i will chalk that up to their site for now. so if we can figure out how to make the click go to a full page, we should be good. =)
- The topic ‘WP-SuperCache w/ Banner Ads’ is closed to new replies.