Google adsense in PHPBB

Discussions about the phpBB2 Forum. How to get the best from this powerful script.

Moderator: Moderators

Postby Upon1 » Tue May 22, 2007 5:15 pm

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.
Upon1
 
Posts: 1
Joined: Tue May 22, 2007 5:11 pm

Advertisement

Postby ultimatehandyman » Wed May 23, 2007 9:04 am

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!
ultimatehandyman
PR2
PR2
 
Posts: 250
Joined: Thu Mar 15, 2007 12:55 am

Postby dcz » Wed May 23, 2007 12:38 pm

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 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

error

Postby scjasoliya » Mon Sep 10, 2007 7:21 am

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?
scjasoliya
 
Posts: 2
Joined: Mon Sep 10, 2007 7:16 am

Postby dcz » Mon Sep 10, 2007 9:16 am

Should not be more than a typo upon install.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

error

Postby scjasoliya » Mon Sep 10, 2007 9:21 am

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?
scjasoliya
 
Posts: 2
Joined: Mon Sep 10, 2007 7:16 am

Postby HB » Tue Sep 11, 2007 8:08 pm

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
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1211
Joined: Mon Oct 16, 2006 2:25 am

Postby SLK » Sun Sep 16, 2007 2:21 pm

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!
SLK
 
Posts: 2
Joined: Sun Sep 16, 2007 2:16 pm

Postby dcz » Tue Sep 18, 2007 10:50 am

dcz wrote:For the second AdSense :
Code: Select all
$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: Select all
$add_switch = (count($total_posts) >= 10 )? TRUE : FALSE;



You could thus use :
Code: Select all
$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 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby SLK » Tue Sep 18, 2007 11:38 am

Hi dcz and thank you for your answer.

Code: Select all
$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)
SLK
 
Posts: 2
Joined: Sun Sep 16, 2007 2:16 pm

Postby dcz » Tue Sep 18, 2007 12:09 pm

Well it should.

Have you replaced the default :
Code: Select all
$add_switch = (( floor( $start / intval($board_config['posts_per_page']) ) + 1 ) < ceil( $total_replies / intval($board_config['posts_per_page'])) )? TRUE : FALSE;


with :
Code: Select all
$add_switch = (count($total_posts) >= 3 )? TRUE : FALSE;


?
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby bytenram » Sun Sep 23, 2007 8:01 pm

this worked perfectly! Thank you for your help.
bytenram
 
Posts: 1
Joined: Sun Sep 23, 2007 7:58 pm

Postby dcz » Mon Sep 24, 2007 11:42 am

;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby littlephoenix » Thu Nov 29, 2007 5:24 am

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
littlephoenix
 
Posts: 3
Joined: Thu Nov 29, 2007 4:55 am

Postby HB » Fri Nov 30, 2007 1:07 am

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
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1211
Joined: Mon Oct 16, 2006 2:25 am

PreviousNext

Return to phpBB2 Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests