Adsense in phpBB3
Posted on May 19th, 2007 in Hacks |
I was experimenting with phpBB3 and I was looking for hacks that would insert google adsense.
There are some hacks out there but I want to show you how I did it.
Take note that phpBB3 is in beta version, both the phpBB3 team and monmonja.com will
not be held responsible for any damage or injury that this hack might result into.
Use it at your own risk.
To insert your adsense code after the first post of every page:
- Open viewtopic.php
- Search for the line:unset($attachments[$row['post_id']]);
- Insert this after that line
if($i == 0){
$postrow = array(
'POST_AUTHOR_FULL' => "Google Ads",
'POST_AUTHOR' => "Google Ads",
'U_POST_AUTHOR' => "Google Ads",
'POST_DATE' => $user->format_date(time()),
'POST_SUBJECT' => "Advertisement",
'MESSAGE' => 'YOUR GOOGLE ADSENSE CODE',
'S_POST_UNAPPROVED' => false,
);
$template->assign_block_vars('postrow', $postrow);
};
To insert at the top of every post (This does not invalidate the terms of google adsense)
- Go to Styles Folder
- Go to subSilver (the default folder)
- Go to template folder
- Open the file viewtopic_body.html
- Insert your adsense code at line 2
Example site at http://monmonja.com/forum/viewtopic.php?f=2&t=3
http://forum.monmonja.com/viewtopic.php?f=7&t=32













6 Responses
That code work on my phpbb3 rc1 forum but i need adsense on index page or forums page.Can you write code for that.Thanks
Hi Dude,
In the viewtopic.php file in phpbb3, the sentence ‘unset($attachments[$row[’post_id’]])’ is not there. I opened it with notepad and tried to search.
I am trying it with phpBB3 RC1. Also the 2nd part of your post, ‘To insert at the top of every post’ is not complete.
If you have tried this and it works, can you please send me the code that works ?
Thanks man,
Andy.
Hi andy,
Sorry it took me so long to reply, ive been so busy with work. i had update the number 2.
I love you!
We had been looking for an elegant way to add advertising without needing to make edits to hundreds of template files. This saved us a lot of headaches.
Currently working great with our forum hosting software. Thanks!
Glad it helped you
I have a flash website
i’m looking for the script who makes google ads with flash.
where can i get it?