vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   how can i place google adsense within postbit (https://vborg.vbsupport.ru/showthread.php?t=259848)

PAKIDIL 03-04-2011 05:18 PM

how can i place google adsense within postbit
 
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
Code:

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

Code:

<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

Code:

<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:

Code:

<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

Quote:

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:
Code:

<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
Code:

<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

Quote:

Originally Posted by PAKIDIL (Post 2170150)
i tried with the above code . its work for the first part
Code:

<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.


All times are GMT. The time now is 02:28 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01063 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete