Jump to content
xisto Community
tansqrx

Howto Add Google Adsense To Phpbb3 Subsilver2 (3.0.4)

Recommended Posts

This tutorial will explain how to add Google Adsense to phpBB version 3 (http://forums.xisto.com/no_longer_exists/) and specifically to version 3.0.4. Before upgrading to version 3.0.4 I had 3.0.1 installed and I was happily using a mod that I found on the phpBB forums called âInline Banner Adâ by geocator (https://www.phpbb.com/community/viewtopic.php?t=306680). I found that upgrading to the latest version significantly changed the way phpBB worked and I was forced to find another solution. My search lead me to âGoogle Adsense Ads and phpBB3 Howtoâ (http://forums.xisto.com/no_longer_exists/) but it was only for prosilver and did not work out of the box for subsilver2. Without finding any other sources I modified the code from âGoogle Adsense Ads and phpBB3 Howtoâ for subsilver2 and here the result.

Full credit goes to http://forums.xisto.com/no_longer_exists/ for most of the work. I never found a way to add ads to the sub-forum page but this will add ads to the following:
⢠Top and bottom of the main page
⢠Top of the forum page (not sub-forums of the forums)
⢠Top of each topic and directly under the first post
⢠Top of the search page

I also didnât like the way the original ads were displayed so I created my own formatting and started from scratch. You can either edit the following files using the built-in editor in the Administrator Control Panel or download them via FTP and then re-upload them.

1. Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
2. Open /styles/subsilver2/theme/stylesheet.css
3. Add the following to the bottom of the file

.google_ad {
border: 1px solid #A9B8C2;
background-color: #ECECEC;
}

4. Save and close /styles/subsilver2/theme/stylesheet.css
5. In Notepad or similar text editor paste the following. Make sure that you replace your Google Adsense code with your own. From here own I will refer to this as the Google Code.

<div class="google_ad">
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-xxx";
google_ad_slot = "xxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js;
</script>
</div>
</div>

6. Open /styles/subsilver2/template/index_body.html
7. Find â<!-- INCLUDE forumlist_body.html -->â
8. Place Google Code before â<!-- INCLUDE forumlist_body.html -->â for top of the main page ad placement
9. Place Google Code after â<!-- INCLUDE forumlist_body.html -->â for bottom of the main page ad placement
10. Save and close /styles/subsilver2/template/index_body.html
11. Open /styles/subsilver2/template/viewforum_body.html
12. Find â<!-- INCLUDE forumlist_body.html -->â
13. Place Google Code before â<!-- INCLUDE forumlist_body.html -->â for top of the forum ad placement
14. Save and close /styles/subsilver2/template/viewforum_body.html
15. Open /styles/subsilver2/template/viewtopic_body.html
16. Find â<!-- BEGIN postrow -->â
17. Place Google Code before â<!-- BEGIN postrow -->â for top of the topic ad placement
18. Find â<!-- END postrow -->â
19. Place â<!-- IF postrow.S_FIRST_ROW -->â Google Code â<!-- ENDIF -->â before â<!-- END postrow -->â for topic ad placement after the first post
20. Save and close /styles/subsilver2/template/viewtopic_body.html
21. Open /styles/subsilver2/template/search_results.html
22. Find â<!-- IF S_SHOW_TOPICS -->â
23. Place Google Code before â<!-- IF S_SHOW_TOPICS -->â for top of the search page ad placement
24. Save and close /styles/subsilver2/template/search_results.html

The results are not as sophisticated as the original mod but I am happy with the results. You can see a working version of this mod at http://forums.xisto.com/no_longer_exists/.

Share this post


Link to post
Share on other sites

thanks, will try, but I'm using vertigo theme right now for my forum.Since the theme looks quite different from subsilver as the size is less than 728x90, is there a way to fix it.The forum is at:mkforums.tkormaplekingdom.splendidtips.com/forum

Share this post


Link to post
Share on other sites

Awesome guide mate! I was just looking for this. Do you know if it's possible to put ads of other companies such AdsBrite, Clicksor or BidVertiser instead of Google AdSense too?

Share this post


Link to post
Share on other sites

Assuming they use JavaScript or something similar (code you insert into your webpage for an ad at a fixed location) yes you can. Replace what I call the Google Code in the above tutorial with the code supplied by your advertiser. I don’t believe this will work for other types of ads such as keyword highlighting (Kontera). Also, if the ads are the same form factor (roughly the same size and shape) as Google, you shouldn’t have to change the CSS styles or anything else.

Share this post


Link to post
Share on other sites

Great modHowto Add Google Adsense To Phpbb3 Subsilver2 (3.0.4)

I followed your instruction step by step and it works great.

-reply by john

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.