sell out (google AdSense and MediaWiki)
Sell out, with me oh yea, sell out, with me tonight
Google company’s gonna give me lots of money
And everything’s gonna be all right
– adapted from “Sell Out”, by Reel Big Fish
I did the unthinkable today and added Google’s adsense code to portions of this site. Me — the guy who used to write complaining emails to webmasters who advertised on the web about how they were sullying the pristine quality of the ‘net. Of course, that was back in 1996 when you still had to know the difference between PPP and SLIP, and a Trumpet Winsock wasn’t some weird woolly thing you put over a brass instrument. Oh well.
In any case, I wanted to put the AdSense code into a MediaWiki v1.5 setup that I have. The previous link was very helpful, but I prefer to have the ads on the left hand side, underneath the default “toolbox” section of the MonoBook skin. So here’s what I did to achieve it…
In adsense.php, remove the lines with a <div> in them. There’s one near the top and one near the bottom. (also, be sure to put your own AdSense code in there or else someone else will get credit for your clicks!)
Now, all you have to do is modify MonoBook.php:
</ul>
</div>
</div>
+ <div class="portlet" id="p-google">
+ <h3> </h3>
+ <div class="pBody">
+ <!-- Google AdSense -->
+ <?php include("adsense.php") ?>
+ </div>
+ </div>
<?php if( $this->data['language_urls'] ) { ?><div id="p-lang" class="portlet">
<h5><?php $this->msg('otherlanguages') ?></h5>
<div class="pBody">
The lines starting with + are the ones you add. You don’t actually inset the actual plus signs themselves. You’re done. There’s no need to modify main.css.





January 24th, 2006 at 7:40 pm
I wholeheartedly support this measure.