In my last post i tried to cover the basics of the integration process as far as the prosilver theme and all the other prosilver based themes out there. Basic styling and some basic code insertion. I promised that i would post a tutorial (and many folks asked me to) regarding the integration of AdSense (or other ads) into subsilver2 based themes, so here it goes.
This time i will keep things related to CSS much more simpler (almost non-existent) as i will make use of default classes. Instead of using an ad block that fits in relatively neat i will give an example of using a table. The visual effect will be almost the same. So feel free to play with some CSS and HTML code (why not even with some PHP as you might want to implement a post counter or other useful queries) to obtain a seamless integration of what i will try to cover here. Practically all the spots where ads will be placed will remain the same as for a prosilver based theme so this time i won’t post screenshots. If you want to make an ideea of how things look check out the other post. So with no further delays here comes the actual guide.
Displaying ads one the index page
- Open index_body.html and find <!– INCLUDE forumlist_body.html –>
- BEFORE it add the following code (this will create an ad block just before the forum list starts):
<table width="100%" cellspacing="0"><tr><td class="cat"><h4>Ads</h4></td></tr></table> <table class="tablebg" width="100%" cellspacing="0"> <tr> <td> <center> <script type="text/javascript"><!-- google_ad_client = "pub-xxxx"; /* 200x90 */ google_ad_slot = "xxxxx"; google_ad_width = 200; google_ad_height = 90; google_color_border = "A9B8C2"; google_color_bg = "A9B8C2"; google_color_link = "000000"; google_color_url = "000000"; google_color_text = "000000"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </center> </td> <td> <center> <script type="text/javascript"><!-- google_ad_client = "pub-xxxx"; /* 728x90 */ google_ad_slot = "xxxx"; google_ad_width = 728; google_ad_height = 90; google_color_border = "A9B8C2"; google_color_bg = "A9B8C2"; google_color_link = "000000"; google_color_url = "000000"; google_color_text = "000000"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </center> </td> </tr> </table>
- If you want to display the ad block just after the forum list ends paste the same code AFTER <!– INCLUDE forumlist_body.html –>
Displaying ads one the viewforum page
- Open viewforum_body.html and find <!– IF not S_DISPLAY_ACTIVE and (S_IS_POSTABLE or .topicrow) –>
- Before it add the SAME code as for the index page.
- If you want to display the ad block just after the forum list ends paste the same code BEFORE <!– IF S_DISPLAY_POST_INFO or TOTAL_TOPICS –>
Displaying ads one the viewtopic page
- Open viewtopic_body.html and find the first appearance of the following code
<table class="tablebg" width="100%" cellspacing="1">
- Before it add the SAME code as for the index page.
- If you want to display the ad block just after the topic list ends past the same code BEFORE the second appearance of the following code (it only appears three times)
<table width="100%" cellspacing="1">
- If you want to display ads before the content of the first post find the following code
<div class="postbody">{postrow.MESSAGE}</div>and BEFORE it add the following
<!-- IF postrow.S_FIRST_ROW --> <script type="text/javascript"><!-- google_ad_client = "pub-xxxx"; /* 728x15 */ google_ad_slot = "xxxx"; google_ad_width = 728; google_ad_height = 15; google_color_border = "ECECEC"; google_color_bg = "ECECEC"; google_color_link = "FFFFFF"; google_color_url = "006699"; google_color_text = "000000"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <br><br> <!-- ENDIF -->
- If you want to display an ad block after the content of the first post AFTER
<div class="postbody">{postrow.MESSAGE}</div>add the following code
<!-- IF postrow.S_FIRST_ROW --> <br><br> <script type="text/javascript"><!-- google_ad_client = "pub-xxxx"; /* 728x90 */ google_ad_slot = "xxxx"; google_ad_width = 728; google_ad_height = 90; google_color_border = "ECECEC"; google_color_bg = "ECECEC"; google_color_link = "FFFFFF"; google_color_url = "006699"; google_color_text = "000000"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <br><br> <!-- ENDIF -->
Displaying ads one the search results page
- Open search_results.html and find <!– IF S_SHOW_TOPICS –>
- Before it add the SAME code as for the index page.
- If you want to add the ad block just after the search block ends add the SAME code BEFORE the following code
<div class="gensmall" style="float: {S_CONTENT_FLOW_BEGIN};">
Well, that covers pretty much the basics of an AdSense integration in a subilsver2 based theme for phpbb3. If you have any questions feel free to leave me a comment.
Subscribe to my feed.
Stumble It! • Digg This! • Save to del.icio.us • Add to Mixx! • Sphinn It! • Email this




Your site has been so helpfull - Thank you.