Extension:Google Adsense
From MediaWiki.org
|
Release status: stable |
|
|---|---|
| Implementation | Skin |
| Description | Adds Google AdSense to the top |
| Last Version | 1.1 (2009-03-20) |
| MediaWiki | 1.13 or newer |
| License | No license specified |
| Download | no link |
| Example | http://www.userdirectory.co.uk |
|
check usage (experimental) |
|
Contents |
[edit] Description
This lets Users put Google Adsense on top of their wiki. See Example.
[edit] Make a Google Adsense Account
Go on to https://www.google.com/adsense/ and register with Google Adsense, (note:it takes two days for your website to get reviewed and approved).
After you can log in, click on Adsense Setup then click on AdSense for Content.
Ad unit - Choose if you just want images, text or both to be shown on your website.
728x90 Leaderboard is what you are going to add to the website so don't alter it. You can change the colors if you wish. Continue until you get the code for the advert, which you need for the step below.
[edit] Adsense.php
Make a file called Adsense.php in the same folder where LocalSetting.php is. Add this code below to file:
<!-- Google AdSense --> <div style="text-align: center; id="column-google">
<script type="text/javascript"><!-- google_ad_client = "pub-xxxxxxxxxxxxxxxx"; /* 728x90, created 3/16/09 */ google_ad_slot = "xxxxxxxxxx"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
</div> <!-- end of Google Adsense -->
The bold should be changed to the code you got from the step above.
[edit] Monobook.php
Go to monobook.php and add this code:
<br> <br>
<!-- Google AdSense -->
<?php include("adsense.php") ?>
Under:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[edit] Monobook/Main.css
Go to the monobook folder and open main.css and alter some of the codes in the file. Change the the code which is in bold.
*/
#column-content {
width: 100%;
float: right;
margin: 0 0 .6em -12.2em;
padding: 0;
}
#content {
margin: 2.8em 0 0 12.2em;
padding: 0 1em 1em 1em;
position: relative;
z-index: 2;
}
#column-one {
padding-top: 160px;
}
Change it to:
*/
#column-content {
width: 100%;
float: right;
margin: 0 0 .6em -12.2em;
padding: 0;
}
#content {
margin: 1.8em 0 0 12.2em;
padding: 0 1em 1em 1em;
position: relative;
z-index: 2;
}
#column-one {
padding-top: 40px;
}
Then find p-cactions (half way in the middle). Change the the code which is in bold.
#p-cactions {
position: absolute;
top: 1.3em;
left: 11.5em;
margin: 0;
white-space: nowrap;
width: 76%;
line-height: 1.1em;
overflow: visible;
background: none;
border-collapse: collapse;
padding-left: 1em;
list-style: none;
font-size: 95%;
}
Change it to:
#p-cactions {
position: absolute;
top: 9.7em;
left: 11.5em;
margin: 0;
white-space: nowrap;
width: 76%;
line-height: 1.1em;
overflow: visible;
background: none;
border-collapse: collapse;
padding-left: 1em;
list-style: none;
font-size: 95%;
}