Log in

View Full Version : how can i place google adsense within postbit


PAKIDIL
03-04-2011, 05:18 PM
Hello,
how can i place google ads in postbit using forum conditions like i don't want it to be appear in forum id 3,4,10,3 and also with user group id like 3,4,5 can view the ads the rest can not

google ads will be look like this :
https://vborg.vbsupport.ru/

waiting for reply
thanks

Lynne
03-05-2011, 03:21 PM
Edit the template and add the ad into there. There is a list of conditonals in the articles forum - have you looked in there? You'll proababy want to use the variable $thread[forumid] for the forumid and $bbuserinfo for the viewer. If you still have problems, please post your *exact* code that you tried and make sure to put code tags around it.

PAKIDIL
03-05-2011, 07:05 PM
i used this code to show the ads as specific .
In Postbit Template

Find:

<!-- / message -->

Add below:

<if condition="(($post[postcount]==1) or ($post[islastshown] and !$GLOBALS['vbulletin']->GPC['ajax']))">
<center>
<script type="text/javascript"><!--
google_ad_client = "youradsensecode";
google_alternate_ad_url = "http://www.yourwebsite.com/collapsible_ad.html";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="yourchannelcode";
google_color_border = "F5F5FF";
google_color_bg = "F5F5FF";
google_color_link = "FF0000";
google_color_url = "000000";
google_color_text = "22229C";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>
</if>


how to add forum id in it i tried to replace the codes with this


<if condition="(($post[postcount]==1) or ($post[islastshown] and !in_array($GLOBALS['forumid'], array(46,51,58,69,75,95,97,100,103))">
<center>
google ad
</center>
</if>


but getting error malfunction conditional statement error .

Lynne
03-05-2011, 11:18 PM
Your parenthesis don't 'add' up is why you are getting the error. Count the number of ( and ) parenthesis in your condition and you should have an equal number. (Hint: you are missing two )) at the end.)

PAKIDIL
03-06-2011, 08:41 AM
Please check this . the add is showing but its showing in all of the forum even i put conditional in forums .
this is what i am placing in postbit

<if condition="(($post[postcount]==1) or ($post[islastshown] AND !in_array($GLOBALS['forumid'], array(46,51,58,69,75,95,97,100,103))))">
google ads
</if>


any help please

BirdOPrey5
03-06-2011, 11:12 AM
You could try $thread[forumid] rather than $GLOBALS[forumid] so:


<if condition="(($post[postcount]==1) or ($post[islastshown] AND !in_array($thread[forumid], array(46,51,58,69,75,95,97,100,103))))">
google ads
</if>


Also when do you want to show the ad, as your condition is written it will:

ALWAYS show in the first ad in the first post in every forum
and show in the Last Post if not in the forums you specify.

That's how its written, is that what you want to do?

PAKIDIL
03-06-2011, 12:11 PM
i want to show in all of the forum except forum id 46,51,58,69,75,95,97,100,103.

and in first post and every after 7 post .

location is in post content.

i am going to try with for $thread[forumid] code

BirdOPrey5
03-06-2011, 12:27 PM
i want to show in all of the forum except forum id 46,51,58,69,75,95,97,100,103.

Does that include the first ad too? Because if so you need to re-do the logic in your conditional...

Also you had nothing for the 7th post... Try this, if I understand what you want:

<if condition="(($post[postcount]==1) OR ($post[postcount] % 7 == 0) AND !in_array($thread[forumid], array(46,51,58,69,75,95,97,100,103)))">


Will display the ad in the first post and every 7th post so long as not in the forums listed.

$post[postcount] % 7 == 0 means if the post count divided by 7 had a remainder of zero, show the ad.

PAKIDIL
03-06-2011, 12:55 PM
i tried with the above code . its work for the first part <if condition="(($post[postcount]==1) or ($post[islastshown]


but not working for the conditional part. because its showing in all forum.

any help please

BirdOPrey5
03-06-2011, 12:58 PM
i tried with the above code . its work for the first part <if condition="(($post[postcount]==1) or ($post[islastshown]


but not working for the conditional part.
any help please

$post[islastshown] doesn't appear anywhere in the code I posted above... you said you wanted it every 7th post, not every last post.

PAKIDIL
03-06-2011, 01:09 PM
thanks for the reply figure it out .

Eagle Eyes
03-23-2011, 06:46 AM
How do i achieve the same thing with vb4?

BirdOPrey5
03-23-2011, 11:22 AM
How do i achieve the same thing with vb4?

Generally the conditions work in VB4 but you add "vb:" in front of the "if" statements such as:


<vb:if condition="XXX">]
code
</vb:if>


If you require more help please make a separate thread in the VB4 forum, this is the VB3 forum and it would be best not to mix the codes.