Nov 23, 2009

Howto Add Google Adsense To Phpbb3 Subsilver2 (3.0.4)

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > How-To's and Tutorials > Websites and Web Designing

Howto Add Google Adsense To Phpbb3 Subsilver2 (3.0.4)

tansqrx
This tutorial will explain how to add Google Adsense to phpBB version 3 (http://www.phpbb.com/index.php) 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 (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://save.link.ba/viewtopic.html) 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://save.link.ba/viewtopic.html 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://ycoderscookbook.com/forums.

 

 

 


Comment/Reply (w/o sign-up)

kingdomtroy
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.tk
or
maplekingdom.splendidtips.com/forum

Comment/Reply (w/o sign-up)

andreip
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?

Comment/Reply (w/o sign-up)

tansqrx
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.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)


See Also,

*SIMILAR VIDEOS*
Searching Video's for Howto, Add, Google, Adsense, To, Phpbb3, Subsilver2, (3.0.4)
advertisement



Howto Add Google Adsense To Phpbb3 Subsilver2 (3.0.4)

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com