| :: |
| Author |
Message |
Upon1
Joined: 22 May 2007 Posts: 1
|
Posted: Tue May 22, 2007 5:15 pm Post subject: Re: Google adsense in PHPBB |
|
|
I tried using this mod, but I could not get it to work. I double checked and retried every step.
What version phpBB does it work on? I am currently using 2.0.17 within PHPNuke. So this could possibly be my problem. |
|
|
| Back to top |
|
 |
|
 |
ultimatehandyman PR2

Joined: 15 Mar 2007 Posts: 209
|
Posted: Wed May 23, 2007 9:04 am Post subject: Re: Google adsense in PHPBB |
|
|
| Upon1 wrote: | I tried using this mod, but I could not get it to work. I double checked and retried every step.
What version phpBB does it work on? I am currently using 2.0.17 within PHPNuke. So this could possibly be my problem. |
I am on the latest version of phpBB and it works fine, but I do not have the PHPNuke installed.
dcz will know if it will work or not!
When you installed it you were not logged into the forum were you? because if you were logged in the ads will not show! |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
Posted: Wed May 23, 2007 12:38 pm Post subject: Re: Google adsense in PHPBB |
|
|
I strongly recommend you update your phpBB installation.
At least you did not post a link to your forum, because this looks like a script kiddie invitation for an easy hack.
I don't think the install could be different using phpnuke, as ultimatehandyman said, the user with user_id = 2 (eg the first admin in most cases) will not see the adds, so try browsing the forum unlogged and logged with another account.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
scjasoliya
Joined: 10 Sep 2007 Posts: 2
|
Posted: Mon Sep 10, 2007 7:21 am Post subject: error |
|
|
when i used this mod i got following error
"Parse error: parse error, unexpected T_STRING in /phpbb2/viewtopic.php on line 1231"
Could u please upload those two modified file please? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
scjasoliya
Joined: 10 Sep 2007 Posts: 2
|
Posted: Mon Sep 10, 2007 9:21 am Post subject: error |
|
|
when i used this mod i got following error
"Parse error: parse error, unexpected T_STRING in /phpbb2/viewtopic.php on line 1231"
Could u please upload those two modified file please? |
|
|
| Back to top |
|
 |
HB phpBB SEO Team

Joined: 16 Oct 2006 Posts: 809
|
Posted: Tue Sep 11, 2007 8:08 pm Post subject: Re: Google adsense in PHPBB |
|
|
| I don't understand your question, but note that the "unexpected T_STRING" is the compiler's way of saying it found something out of place. It could be a simple missing ";", missing "$" in front of a variable, or similar typo. If you need help figuring it out, post the code 10 lines before and 10 lines after line 1231. |
_________________ Dan Kehn |
|
| Back to top |
|
 |
SLK
Joined: 16 Sep 2007 Posts: 2
|
Posted: Sun Sep 16, 2007 2:21 pm Post subject: Re: Google adsense in PHPBB |
|
|
Thank you very much for this mod!
I have one wich though, I would like to have displayed an ad after the first post on every page and if there is more than two posts on a page then also an ad in bottom.
This ad only add ad in bottom if there is more pages.
Hope you understand.
I have tried with som if statements but im not very good at it.
Bad at english so Ill explain again just to be sure:
1 post (on page! not just in topic) = 1 ad after first post
2+ posts (on page! not just in topic) = 2 ads, one after first posts, one in bottom
Hope you can help im not so good with php but Ill try, and if I find out how to do that Ill post it in here.
But Ill hope for help, very good site! |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
Posted: Tue Sep 18, 2007 10:50 am Post subject: Re: Google adsense in PHPBB |
|
|
| dcz wrote: |
For the second AdSense :
| Code: | | $add_switch = (( floor( $start / intval($board_config['posts_per_page']) ) + 1 ) < ceil( $total_replies / intval($board_config['posts_per_page'])) )? TRUE : FALSE; |
Here, we check if there is another page in this topic and decide to output the AdSense.
We could for example only check that this topic page has more than n post in it before we add a second ad sense :
| Code: | | $add_switch = (count($total_posts) >= 10 )? TRUE : FALSE; |
|
You could thus use :
| Code: | | $add_switch = (count($total_posts) >= 3 )? TRUE : FALSE; |
To add the second add after the 3rd post, if any.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
SLK
Joined: 16 Sep 2007 Posts: 2
|
Posted: Tue Sep 18, 2007 11:38 am Post subject: Re: Google adsense in PHPBB |
|
|
Hi dcz and thank you for your answer.
| Code: | | $add_switch = (count($total_posts) >= 3 )? TRUE : FALSE; |
- doesnt work for me, nothing gets outputtet (add_add works though)
Nor > 3 works.
But < 3 works, then the add is showing all the time.
There is just one problem, I want it to check so that there won't be showing two ads right after each other.
Ex:
Let's say we have a topic on 2 pages. Total_post_on_page = 15
There is total replies: 16
Then on page 2 there is 1 post.
Then this code will add 1 ad, the ad after the first post, and then also add the add_switch, so there will be two ads right after each other.
How to prevent this? - IF i'd like to show the bottom ad all the time (if reply > 1) |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
bytenram
Joined: 23 Sep 2007 Posts: 1
|
Posted: Sun Sep 23, 2007 8:01 pm Post subject: Re: Google adsense in PHPBB |
|
|
| this worked perfectly! Thank you for your help. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
littlephoenix
Joined: 29 Nov 2007 Posts: 3
|
Posted: Thu Nov 29, 2007 5:24 am Post subject: Re: Google adsense in PHPBB |
|
|
cant you just place your ads inside the viewtopic_body.tpl and skip all the code changes? or place the ads in the overall_header.tpl as needed, i dont get the purpose of this, anyone explain ?
thanks |
|
|
| Back to top |
|
 |
HB phpBB SEO Team

Joined: 16 Oct 2006 Posts: 809
|
Posted: Fri Nov 30, 2007 1:07 am Post subject: Re: Google adsense in PHPBB |
|
|
You could place it in overall_header.tpl, if you don't mind the ad being omni-present. Google does have fussy terms of service conditions that don't allow for ads on non-content pages, which would include login.php, profile.php, etc. Putting it in overall_header.tpl would mean everywhere, though it wouldn't be hard to add switches to allow finer control.
The code above is necessary in lieu of directly modifying viewtopic_body.tpl because otherwise the ad would appear after ever single post. I mix it up a bit depending on the length of the thread and randomly twiddle the ad background/foreground colors so the members don't "tune out" the ads so quickly. |
_________________ Dan Kehn |
|
| Back to top |
|
 |
|
|