vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   adsense in first post (https://vborg.vbsupport.ru/showthread.php?t=140234)

jcodemasters 02-23-2007 01:15 PM

adsense in first post
 
Hello,
I am wondering, if anyone here can tell me how to add adsense code in first post at the bottom.. just like this http://www.talkgold.com/forum//r152221-.html

I just would like to know template name.. :)

it would be really good.. if i can add this after every second post too :D

CyberAlien 02-23-2007 02:34 PM

Don't know if this will work, but...

open includes/class_postbit.php, find this:
Code:

        function construct_postbit(&$post)
        {

add after it:
Code:

                static $post_counter;
                if(!isset($post_counter))
                {
                        $post_counter = 0;
                }
                else
                {
                        $post_counter ++;
                }

then in postbit use <if condition="$post_counter == 0"> ad code here </if>

jcodemasters 02-23-2007 02:36 PM

Quote:

Originally Posted by CyberAlien (Post 1189085)
Don't know if this will work, but...

open includes/class_postbit.php, find this:
Code:

        function construct_postbit(&$post)
        {

add after it:
Code:

                static $post_counter;
                if(!isset($post_counter))
                {
                        $post_counter = 0;
                }
                else
                {
                        $post_counter ++;
                }

then in postbit use <if condition="$post_counter == 0"> ad code here </if>

thank you all try for this..

Digitalus 02-23-2007 02:58 PM

You can add this in your postbit or postbit_legacy..
This is the easy way ;)

Code:

<if condition="$post[postcount] == 1">

<table class="tborder" cellpadding="6" cellspacing="0" border="0" width="100%" align="center">
<tr>
        <td class="thead" align="left">-- Sponsored Links --</td>
</tr>
<tr>
        <td class="alt1" align="center"> Here you ads code        </td>
</tr>
</table>
</if>


CyberAlien 02-23-2007 03:05 PM

Doh. If I only knew about $post['postcount'] variable... :)

jcodemasters 02-24-2007 06:12 PM

thanks it works perfect but when i used this <if condition="fmod($post[postcount],2) == 0"> it gave me this error
The following template conditional expression contains function calls:
With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.

can any one suggest how to display adsense after every second post?

CyberAlien 02-24-2007 06:22 PM

Try <if condition="($post[postcount] % 2) == 0">

jcodemasters 02-24-2007 07:26 PM

Quote:

Originally Posted by CyberAlien (Post 1189871)
Try <if condition="($post[postcount] % 2) == 0">

You rock.. one last question how to check last post .. thanks again for your reply

i got it..

<if condition="(($post[postcount]==1) or ($post[islastshown] and !$GLOBALS['vbulletin']->GPC['ajax']))">

turkerm 02-24-2007 10:28 PM

Hi there!

This one rocks. I searched throughout the net and find this. Thanks.

How can we implement this code for each page of a thread? Because it is only valid for the first post of a thread.

Thanks!

jcodemasters 02-24-2007 10:31 PM

this will work for first and last page of every post

<if condition="(($post[postcount] % $vboptions[maxposts] == 1) or ($post[islastshown] and !$GLOBALS['vbulletin']->GPC['ajax']))">


All times are GMT. The time now is 09:52 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.01166 seconds
  • Memory Usage 1,737KB
  • 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
  • (5)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