View Full Version : Forum Display Enhancements - Google AdSense (or other) after post...
goranbaxy
01-28-2008, 10:00 PM
I found this cod on vublletin.org and did some customization, I found this very useful and good place for ads.
Show a banner/ad after first (or somewhere else) post, show it to guests | register users | users with less then X posts...
This is what I have:
- It will show ad/banner after first post on every page (instead of just the first page) but only to guests.
Admin CP -> Styles & Templates -> Style Manager -> ? ? -> Postbit Templates ->
Edit postbit or postbit_legacy (depending on which layout you are using)
Find:
<!-- / post $post[postid] popup menu -->
After ad:
<if condition="$post[postcount] % $vboptions[maxposts] == 1 AND !$bbuserinfo[userid]">
<div style="padding: $stylevar[cellpadding]px 0px 0px 0px">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="thead" align="left">Sponsored Links</td>
</tr>
<tr>
<td class="alt1" align="center">
BANNER CODE HERE
</td>
</tr>
</table>
</div>
</if>
Here is how it will look like: demo ads (http://www.dojaja.biz/dforum/forum-igraona/269-kaladont-na-bodove-287.html)
Here are several other conditions you can use in the above code to show the banner in different places. Simply replace the first "if" statement.
...after the first post on every page (instead of just the first page):
<if condition="$post[postcount] % $vboptions[maxposts] == 1">
...after the first post, but only for guests:
<if condition="$post[postcount] == 1 AND !$bbuserinfo[userid]">
...after the first post, but only if the thread has at least 2 replies (so you never see a banner and only 1 post):
<if condition="$post[postcount] == 1 AND $GLOBALS[threadinfo][replycount] >= 2">
...after the first post, but only in specific forums (where X,Y,Z is a comma list of forumids):
<if condition="$post[postcount] == 1 AND in_array($GLOBALS[forumid], array(X,Y,Z))">
...after every X posts (replace X with a number):
<if condition="$post[postcount] % X == 0">
...after the last post on every page:
<if condition="$post['islastshown']">
...between the last and second to last post on every page (need to move the above code to the very top of the template instead of the bottom, then use the same condition as above):
<if condition="$post['islastshown']">
You can use pieces of these conditions to do different combinations. For example, this condition will show the banner after the first post on every page (instead of just the first page), but only for guests, and only in certain forums (where X,Y,Z is a comma list of forumids):
<if condition="$post[postcount] % $vboptions[maxposts] == 1 AND !$bbuserinfo[userid] AND in_array($GLOBALS[forumid], array(X,Y,Z))">
Please click to "Mark as Installed"
projectego
01-29-2008, 06:35 PM
Nice one! Thank you. :D
goranbaxy
01-29-2008, 06:38 PM
If anyone use some custom code and want to share it let me know and I'll include it in first post.
SEOvB
01-29-2008, 07:45 PM
how is this different then the other 8 billion ones already out there?
goranbaxy
01-29-2008, 07:50 PM
I don't know, this is something I was looking for and didn't found so I add it here, if there is thread same as this one, feel free to delete it (anyone who can)
iogames
01-29-2008, 11:36 PM
Does vBAd management have something like this... doesn't it?
goranbaxy
01-30-2008, 04:53 AM
VBAd doesn't work for me, so I'm editing my templates for inserting ads
Forumdayim.Net
01-30-2008, 10:36 AM
Can you add a screenshot ?
goranbaxy
01-30-2008, 10:50 AM
added! (it's only visible to guests).
usearchme
01-31-2008, 12:07 PM
added very handy tips
goranbaxy
01-31-2008, 12:27 PM
If you are displaying ads only to guests you can replace this code:
<td class="thead" align="left">Sponsored Links</td>
with this one:
<td class="thead" align="left"><a href="http://www.mysite.com/linkToPost.php">Remove ads from forum!</a></td>
Red part of cod should be replaced with link to a topic where you can explain that if some one register he will see "ads free" forum!
piloto-43
02-01-2008, 05:36 AM
thanks..
installed.
Prince
02-01-2008, 02:09 PM
very nice, thanks.
Soonerdude
02-05-2008, 12:28 AM
How would you make it visible only to certain usergroups?
I'd like to make it not visible to admins, mods, and donors.
goranbaxy
02-05-2008, 05:13 AM
You can try this:
<if condition="!is_member_of($bbuserinfo, X, Y, Z)">
Where X, Y and Z are the IDs of admin, mods and donors.
Try it and let me know did it work.
induslady
02-06-2008, 06:01 PM
Hi,
I tried using this conditional code of yours...
<if condition="$post[postcount] % X == 0">
Replaced 'X' with 5.
In a thread with a total of 37 posts, it displays the ad after the 5th post, 15th post, 25th post and 35th post.
But it is just making space for the ad after the 10th post, 20th post, 30th post. But not showing the ad. Why?
Please can you help fix this for me.
This also spoiled the display of ads after the last post in every page that was working fine earlier.
I'm also using conditionals for "after 1st post on every page", that is working fine.
Thanks in advance.
goranbaxy
02-07-2008, 05:29 AM
@induslady: can you add a screen shoot, I'm not sure I understand what you're talking about.
induslady
02-08-2008, 08:33 PM
Hello,
Thank you for your response. I am attaching screen shots and have explained below what's happening on using this condition...
<if condition="$post[postcount] % X == 0">
replaced X with 5.
Meaning, I want to show Google ads below every 5th post in the thread.
My forum threads have max 10 posts per page.
Using the above condition, I am able to get ads displayed below 5th post. (refer image 1 - showing ad)
But ads are not getting displayed below 10th post. (refer image 2 - no ad - white space)
While ads are getting displayed below 15th post too. (refer image 3 - showing ad)
But again ads are not getting displayed below 20th post. (refer image 4 - no ad - white space)
I used to have conditions included for displaying ads "below the 1st post in all pages of the thread and below the last post in all pages of the thread".
After I included the above condition to display ad below the 'X' post,
the condition for displaying ads below last post in all pages of a thread is also not working.
While I have ads below 1st post in all pages of a thread working fine.
Hope my issue is clear now with the screen shots and the explanation.
Please advise. Thanks.
goranbaxy
02-10-2008, 10:25 AM
Did you use this code to display ads on last post on every page?
<if condition="$post['islastshown']">
induslady
02-13-2008, 12:18 AM
Yes, to display ads below the last post in all pages of the thread, I use...
<if condition="$post['islastshown']">
To display ads below the 1st post in all pages of the thread, I use...
<if condition="$post[postcount] % $vboptions[maxposts] == 1 AND $GLOBALS[threadinfo][replycount] >= 2">
When I use the below condition to display ad below every 5 posts(replacing X as 5), the former last post display does not seem to work. While the latter 1st post display works fines.
<if condition="$post[postcount] % X == 0">
What could be the issue? Please advise.
phpnewbie
02-13-2008, 02:50 PM
how can i move the "Similar threads" after 1st post ?
i had remove "$similarthreads" in SHOW_THREAD templates
and add it after the 1st post, like this tutorial, but it doesn't show...
Thanks for your helping
VBUsers
02-16-2008, 08:54 AM
worked great for me thanks
Phr34q
03-08-2008, 07:05 AM
Neat and handy, works with adbrite on my 3.6.8pl2 install.
Visible to guests only of course ;)
I used the "show to certain groups" and "show in certain forums".
"Installtime" less than 30 secs.
*clicks installed*
goranbaxy
03-08-2008, 07:20 AM
@induslady I'm sorry, I really don't know where is the problem, you should look at the code to si if the ads are generated or not, if they are then the problem is in your custom template.
@Phr34q you can use any advertisement code, it's ;)
Phr34q
03-08-2008, 08:08 AM
@goranbaxy, I know, just thought I'd put in in my reply so others can read that it's possible before they start a "help help can I use ...." post ;)
goranbaxy
03-08-2008, 08:13 AM
Oh, ok thanks!
Coop1979
05-01-2008, 02:31 PM
The problem for you, induslady, is that you can only have 3 Google Adsense spots on each page. If you have more than that, the Adsense code just blanks out.
kutukupret
05-25-2008, 11:49 AM
how about if i use this only for guest and registered member, but not showing for staff or paid member ?
ArnyVee
05-26-2008, 10:49 PM
Worked for me, thanks. :D
Suicide BULLET
05-31-2008, 01:25 AM
how can i make the ads visible to all groups , ( registered , mods, admins ,and guests ) ?
goranbaxy
05-31-2008, 09:35 AM
Just don't put any condition
Suicide BULLET
05-31-2008, 10:08 AM
thanks man .. *installed*
Suicide BULLET
05-31-2008, 11:48 AM
sorry .. but after i removed the codition the ads appeared after every post
i want it to be visible to all groups
and after the 1st post only
Leo Brazil
06-04-2008, 05:33 PM
Does it work for 3.7 ?
ArnyVee
06-17-2008, 11:47 PM
Working for me on 3.7.1 P1 :D
goranbaxy
06-18-2008, 05:27 AM
sorry .. but after i removed the codition the ads appeared after every post
i want it to be visible to all groups
and after the 1st post only
Sorry, try this one:
<if condition="$post[postcount] % $vboptions[maxposts] == 1">
ArnyVee
06-18-2008, 10:30 AM
I originally had it on the 1st page of every thread (between first and second post), but I changed it to every page because it just wasn't enough exposure for the 'long' threads. Most people jumped to the last page and missed the ad. Just a tip ;)
ehsanix
07-25-2008, 06:18 PM
thanks installed but has problem with quich reply issue for me
it redirects poster to advertises included after last posts
ehsanix
07-25-2008, 06:29 PM
AFTER A LITTLE SEARCH I FOUND THIS :
<if condition="($post['islastshown'] and !$GLOBALS['vbulletin']->GPC['ajax'])">
goranbaxy
07-26-2008, 12:03 PM
where di you put that code?
ehsanix
07-28-2008, 06:57 PM
it's just same as mentioned above
i just used this one :
<if condition="($post['islastshown'] and !$GLOBALS['vbulletin']->GPC['ajax'])">
instead of this :
<if condition="$post['islastshown']">
to fix quick reply issue
LeMans350z
10-03-2008, 03:46 PM
I am trying to add a banner ad before the first unread post. I have done this in the past; however I have spent the last two hours searching for the code I used with no luck.
Does anyone know how to modify the conditional to display the ad before the first unread post?
Thanks in advance for any help.
Bansheebob
01-05-2010, 11:31 PM
Ive tried this on 3.6.8 and keep getting errors?
goranbaxy
01-06-2010, 05:02 AM
Bansheebob post the error here
Leo Brazil
01-06-2010, 09:47 AM
I wish to see this one for 4.0, you know, matching 4.0 postbit (or legacy) design.
This one is so much flexible and does the job perfectly.
s-p0k
01-07-2010, 04:39 PM
If anyone use some custom code and want to share it let me know and I'll include it in first post.
I would like to know my self. Cna't find no code for ad..I would like to put some ad in my Sidebar Column
atcspaul
09-10-2010, 02:04 AM
is their a way to have the ad show after 1st and 5th post on every page for everyone? i am not to good with a computer. :( thank you
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.