View Full Version : Adding Adsense to PHPBB
NewComputer
Nov 8th 2004, 6:56 pm
Hello to any fellow PHPBB users. I would like to use vbulletin, but at this point phpbb being free is too good to pass up. Anyways, what I want to do is add my adsense code after the first post of any thread.
I have scoured PHPBB forums etc... with no luck. Lots on how to add it to the header or footer, but nothing after the first post. I have seen this in other forums (eg. http://www.techimo.com/forum/t126440.html
Anyone have any thoughts on where or how I would do this?
PS: Techimo uses vbulletin, but you get the idea...
digitalpoint
Nov 8th 2004, 6:59 pm
I know how to do it on vBulletin... does that help? :) It shouldn't be too hard with phpBB I wouldn't think.
ResaleBroker
Nov 8th 2004, 7:35 pm
I know how to do it on vBulletin... does that help? :)I'd be interested in knowing how to do that Shawn. I'm using VB 3.03. Can you PM me? If you don't have the time can you point me to a resource?
Sorry NC, I'm not trying to highjack your thread. ;)
digitalpoint
Nov 8th 2004, 7:42 pm
In the postbit template, use this logic towards the end of it:
<if condition="$post[postcount] % 10 == 1">
Your AdSense code here...
</if>That assumes you display 10 posts at a time. You could get fancy and look to see how many posts per page the user is set to see (in case they change the default), but I was lazy. You could also use the FIRSTPOST variable instead, but my way lets you put it after whatever post you want by setting the 1 to whatever you want.
ResaleBroker
Nov 8th 2004, 8:58 pm
Thanks Shawn. I appreciate the help. :)
NewComputer
Nov 9th 2004, 5:58 am
In the postbit template, use this logic towards the end of it:
<if condition="$post[postcount] % 10 == 1">
Your AdSense code here...
</if>That assumes you display 10 posts at a time. You could get fancy and look to see how many posts per page the user is set to see (in case they change the default), but I was lazy. You could also use the FIRSTPOST variable instead, but my way lets you put it after whatever post you want by setting the 1 to whatever you want.
I believe the two are similar, I have seen that code somewhere before. I would assume using <td> etc... to display would work as well? Or would you leave it and let the display be set to follow the threads?
digitalpoint
Nov 9th 2004, 8:32 am
Not sure to be honest... it really depends on how phpBB generates and spits out the threads.
stephfoster
Nov 9th 2004, 4:49 pm
I saw another forum doing this, but no idea how it was done. You could go there and ask where they found it. The site is http://selfstartersweeklytips.com/forum/
johncr
Nov 11th 2004, 11:41 am
...what I want to do is add my adsense code after the first post of any thread.
Search 'Banner AdSense After First Post' or 'Banner Ad After First Post' (I don't remember exactly) at phpBB. It works fine.
kusadasi-guy
Nov 11th 2004, 5:46 pm
http://www.phpbb.com/phpBB/viewtopic.php?t=232463&postdays=0&postorder=asc&start=0
NewComputer
Nov 11th 2004, 6:04 pm
Thanks guys, I had found that thread a while ago, but I have had a buddy look at implementing for me. I am trying to figure the co op ad network...
johncr
Nov 12th 2004, 8:09 am
I have had a buddy look at implementing for me. I am trying to figure the co op ad network...
It was tricky while under development. I don't remember the whole installation process, but there are two zip's find and read'em plus the whole thread. As far as I remember a database mod is required too.
DarrenC
Nov 13th 2004, 10:49 am
To install Adsense just find your overall header or overall footer files, and then enter the javascript code.
These files are usually found in the template folder.
It's simple!
I've just added it to mine.
Darren
NewComputer
Nov 13th 2004, 11:16 am
To install Adsense just find your overall header or overall footer files, and then enter the javascript code.
These files are usually found in the template folder.
It's simple!
I've just added it to mine.
Darren
Thanks WW,
But my inquiry was actually for after the first post in a thread.
Design1
Dec 11th 2004, 9:39 pm
Thanks for these posts! I was curious on how to do it but i just haven't gotten around to doing it or spending the time trying to figure it out. I appreciate it! :D
joeychgo
Dec 11th 2004, 9:54 pm
actually - to ad adsense to VB - just add the adsense code to whatever template you want it to show, where you want it to show. You can add it almost anywhere.
For example - to add it above the quick reply box - just look for $quickreply in your showthread template and insert the adsense code above $quickreply.
Play with it.
dcristo
Jul 9th 2005, 2:40 pm
Hello to any fellow PHPBB users. I would like to use vbulletin, but at this point phpbb being free is too good to pass up. Anyways, what I want to do is add my adsense code after the first post of any thread.
I have scoured PHPBB forums etc... with no luck. Lots on how to add it to the header or footer, but nothing after the first post. I have seen this in other forums (eg. http://www.techimo.com/forum/t126440.html
Anyone have any thoughts on where or how I would do this?
PS: Techimo uses vbulletin, but you get the idea...
I know this is an old thread but no one really gave you a solution.
I finally found one on the net, check this thread (http://forums.digitalpoint.com/showthread.php?t=20769) I created out.
crazyhorse
Jul 9th 2005, 2:47 pm
I know this is an old thread but no one really gave you a solution.
I finally found one on the net, check this thread (http://forums.digitalpoint.com/showthread.php?t=20769) I created out.
What i did was a while ago install Extreme styles mod . (http://www.phpbbstyles.com/viewtopic.php?t=356). If you got that mod installed. Type the following code in your viewtopic_body.tpl template file
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- END postrow -->
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<?php if($postrow_i == 0) { ?>
<tr>
<td colspan="2" align="center" class="row1">
put here your ad code
</td>
</tr>
<?php } ?>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
dcristo
Jul 9th 2005, 2:51 pm
There's no mods to install for this fix, you just have to edit the viewtopic.php and viewtopic_body.tpl files.
crazyhorse
Jul 9th 2005, 3:04 pm
There's no mods to install for this fix, you just have to edit the viewtopic.php and viewtopic_body.tpl files. OK didnt notice that. Well anyways i wanted to have the mod installed . It allows me to code php directly into my files through the forum admins section.
dcristo
Jul 9th 2005, 3:09 pm
I see.
Im really liking this adsense integration. It works really well with the link units format it's not too in the face of my forum members.
RectangleMan
Jul 16th 2005, 3:21 pm
I have adsense integration on my phpbb sites as well.
http://www.pspforums.com and I have it setup so that certain ads are for guests only. I have a subscription mod installed and subscribers see the site ad free. It has worked out very well for me.
If anyone needs phpbb help I am the man to go to. I can do anything with phpbb.
http://www.360forum.com
http://www.blackjackforums.com
These are just 2 of my sites that I even skinned myself.
:-)
phpbb rocks if you know what you are doing.
dcristo
Jul 16th 2005, 4:29 pm
Your da man yo!
I just had a quick browse of your xbox forums, looks good, but u may wanna look into improving load times its very slow even on broadband.
RectangleMan
Jul 16th 2005, 6:58 pm
Thanks. The load time may also be part of the ads if you are not a member.
Bernard
Oct 24th 2005, 3:13 pm
I have adsense integration on my phpbb sites as well.
http://www.pspforums.com and I have it setup so that certain ads are for guests only.
This is what I want to do. I currently show adsense to everyone. What condition do I need to check/wrap around the adsense code to exclude it for logged in members?
Bibofa
Oct 30th 2005, 12:55 am
Your da man yo!
Bibofa
Oct 30th 2005, 12:57 am
This is what I want to do. I currently show adsense to everyone. What condition do I need to check/wrap around the adsense code to exclude it for logged in members?
I agree with you
Yellowberry.org
Oct 30th 2005, 1:00 am
I will try to fix it on my swedish forum i got some nice ideas now thanks
techlh
Nov 4th 2005, 9:59 am
Does anyone know the PHP to add for determining if the user is logged in or not?
993ti
Nov 4th 2005, 10:05 am
In php files:
if ( $userdata['session_logged_in'] )
{
CODE HERE
}
In tpl files:
<!-- BEGIN switch_user_logged_out -->
CODE HERE
<!-- END switch_user_logged_out -->
993ti
Nov 4th 2005, 10:10 am
This is what i have in viewtopic.php:
Find:
}
$template->pparse('body');
REPLACE wITH
if($i == 0)
{
$row_color = ( !($num_post % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($num_post % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$num_post ++;
$message = 'ADSENSE CODE HERE';
$template->assign_block_vars('postrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'POSTER_NAME' => 'Google',
'POST_DATE' => '',
'POST_SUBJECT' => 'Sponsored Link',
'MESSAGE' => $message,
'MINI_POST_IMG' => $mini_post_img,
'U_POST_ID' => '0'
));
}
}
$template->pparse('body');
techlh
Nov 4th 2005, 10:13 am
Thanks, you rock!
To install Adsense just find your overall header or overall footer files, and then enter the javascript code.
These files are usually found in the template folder.
It's simple!
I've just added it to mine.
Darren
Just spotted this as I'm figuring out how to do it on my new vb board. just having it in the header could be a breach of TOS as it will also show on non-content pages like login and profiles.
Imran
Feb 8th 2006, 8:04 am
thats true having in header does breach TOS, but here DP as well its in header?
what say?
thats true having in header does breach TOS, but here DP as well its in header?
what say?
Its not on the log-on and register pages here, its just a link, not the adsense code. I choose to be extra careful and keep it off all the search, admin, profile pages etc, as well. I've got it on raw content pages only. Showthread, forum display and forumhome only.
dcristo
Feb 8th 2006, 2:52 pm
Just spotted this as I'm figuring out how to do it on my new vb board. just having it in the header could be a breach of TOS as it will also show on non-content pages like login and profiles.
Start up a new thread dude you should get a better response, this is a phpbb and adsense thread.
Start up a new thread dude you should get a better response, this is a phpbb and adsense thread.
Hehe - surfed in through the Archive - but this is also relevant for PHPBB and Adsense. Any forum software in fact - global headers and adsense are a no-no if they also display on Login and other non-content pages. :)
dcristo
Feb 8th 2006, 4:54 pm
Hehe - surfed in through the Archive - but this is also relevant for PHPBB and Adsense. Any forum software in fact - global headers and adsense are a no-no if they also display on Login and other non-content pages. :)
True, but knowing which templates to edit is a different story though.
GTAce
Feb 8th 2006, 9:39 pm
Not only is it a phpBB thread, but it is a phpBB thread that is well over a year old ;)
Not only is it a phpBB thread, but it is a phpBB thread that is well over a year old ;)
That's as maybe, but as I found myself here via the archive and a few key search terms in Google, I thought it would be a good idea to add the appropriate info rather than have others end up here and not realise, and risk their AdSense accounts. :)
To bring it straight back on topic - if you want to do it PHPBB, the templates you can add the code to for the meatiest content pages are: index_body.tpl, viewforum_body.tpl and viewtopic_body.tpl :)
ala101
Feb 14th 2006, 12:58 pm
hello
is it possible to put the google adsense code in a separate file
'adsense.php'
and then i put this command in 'index.php' :
include ('adsense.php')
if this is possible..
how can i do it plz ?
ptw419
May 12th 2006, 11:53 pm
This site should be handy
http://www.phpbb.com/kb/article.php?article_id=153
I've been looking into it recently, and although not very specific, it gives a decent idea of what should be done.
whynotme1432
May 26th 2006, 12:33 pm
This guy at this site showed me how to put the adsense on phpBB. Just an FYI:
http://letstalkcoding.com/
WhyNotMe:D
http://letstalkcoding.com/
993ti
May 27th 2006, 7:49 pm
I did mine like this:
OPEN - includes/page_header.php
FIND
define('HEADER_INC', TRUE);
AFTER ADD
if ( $userdata['session_logged_in'] && ($googlead=="1") ){
$google_ad = '';
}
else
if ($googlead=="1") {
$google_ad = '<table class="forumline" width="95%" cellspacing="1" cellpadding="3" border="0">
<tr>
<td class="row1" height="100%" valign="top">
<div align="center">
ADSENSE CODE HERE
</div>
</td>
</tr>
</table>';
}
OPEN - templates/yourtemplate/overall_header.tpl
ADD THIS WHEREEVER YOU WANT
{GOOGLE_AD}
Now you can add this at the top of the php files (before define('IN_PHPBB', true);) where you want the ad to show (index.php, viewtopic.php, viewforum.php and so on)
$googlead="1";
I use it on my aibo forum if you want to check it out.
doorbeck
Oct 18th 2006, 12:38 am
There's a great step-by-step guide to adding adverts after every first post at:
http://www.askdavetaylor.com/phpbb_trick_for_including_google_adsense_between_articles.html
No mods needed, and very simple to follow! You can see the results at:
http://www.moonrobot.org/phpbb/
Cheers,
doorbeck
link.sa
Oct 28th 2007, 2:11 am
Here is great tutorial about adding Google AdSense Ads to phpBB3 forum. Looks great and completely Google AdSense Program Policies friendly.
http://save.link.ba/index.html
kber
Nov 4th 2007, 1:33 pm
Try this Mod
http://phpbbegypt.com/phpBB3/viewtopic.php?f=9&t=73
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.