Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-06-2012, 01:31 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to displaying advert after first post, 15th post and 29th post?

How do I identify the first, 15th and 29th post on the page please?
And then in the conditional in postbit_legacy, do I just eval the similar templates for each advert?
Reply With Quote
  #2  
Old 09-06-2012, 02:19 PM
RyanFabbro's Avatar
RyanFabbro RyanFabbro is offline
 
Join Date: Aug 2012
Location: MI, USA
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

im not 100% on this sombody correct me if im wrong, i know for a fact to get it to display after the first post you would go into postbit / postbit legacy and at the very bottom add
Code:
<if condition="$post[postcount] == 1">
your ad code here
</if>
so i can only assume what your looking for would be the same steps but use
Code:
<if condition="$post[postcount] == 1,15,29">
ad code
</if>
again im not 100% on that, and dont relly want to make 29 tests post to check it lol sry but it seems right =)
Reply With Quote
  #3  
Old 09-06-2012, 02:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Spinball View Post
How do I identify the first, 15th and 29th post on the page please?
I think you can use <if condition="in_array($GLOBALS['counter'], array(1, 15, 29))">. That will identify the post number on the current page, not in the thread. I think the default is 10 posts per page, so with the default you wouldn't ever see the 15th or 29th.


Quote:
And then in the conditional in postbit_legacy, do I just eval the similar templates for each advert?
Sorry, I don't understand what you're asking.
Reply With Quote
  #4  
Old 09-07-2012, 07:06 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. Default for our forums is 30 posts per page.
In each of those locations I want to display an advert.
I'm guessing the best option is to eval a template? But a different one each time?
Reply With Quote
  #5  
Old 09-07-2012, 12:31 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Spinball View Post
I'm guessing the best option is to eval a template? But a different one each time?
Well, I guess it depends on what your advert code is like. I guess what you want to do is have a plugin somehow get the html for each ad location and put it in variables that can be used in the postbit template, but how you get the html is up to you. If you want to make a template for formatting an ad you could od that, or you could just put the html in your plugin (if the ad is just an image, that might be the easiest way).
Reply With Quote
  #6  
Old 09-08-2012, 12:19 AM
RyanFabbro's Avatar
RyanFabbro RyanFabbro is offline
 
Join Date: Aug 2012
Location: MI, USA
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

why wouldn't my recomendation of if condition postcount work for this?
Reply With Quote
  #7  
Old 09-08-2012, 03:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RyanFabbro View Post
why wouldn't my recomendation of if condition postcount work for this?
Well, for one thing this doesn't work because you can't just list values like that:
Code:
<if condition="$post[postcount] == 1,15,29">
ad code
</if>

but maybe you were thinking of using in_array(), like:
Code:
<if condition="in_array($post[postcount], array(1,15,29))">
ad code
</if>

even so, I think $post[postcount] is the count of the post within the entire thread, and I think the OP asked about the posts on each page (so I think the condition above wouldn't show anything after the first page).
Reply With Quote
  #8  
Old 09-09-2012, 05:09 AM
RyanFabbro's Avatar
RyanFabbro RyanFabbro is offline
 
Join Date: Aug 2012
Location: MI, USA
Posts: 64
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i will test this really quick and post the results

ok OP this is what you should use, it just requires a simple code into postbit legacy no plugins required, kh was right i had the condition wrong but the idea was correct i used

<if condition="in_array($post[postcount], array(1,15,23))">
<center><h1>ad code</h1></center>
</if>

at the very bottom of postbit legacy, with threads set to display 10 per page, so each post 1 15 and 23 were on seperate pages, the adcode displayed correctly under each post i specified, no matter the page it was on

this method works great and i will be using it myself now too.
Attached Images
File Type: jpg 9-9-2012 2-11-40 AM.jpg (45.5 KB, 0 views)
File Type: jpg 9-9-2012 2-12-21 AM.jpg (116.7 KB, 0 views)
File Type: jpg 9-9-2012 2-12-48 AM.jpg (180.4 KB, 0 views)
Reply With Quote
  #9  
Old 09-09-2012, 11:18 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I think spinball has 30 posts per page and wanted the ads to show up on each page. But now that I think about it, you could use ($post[postcount] % 30). And I think that is a better solution especially since it looks like the 'counter' variable isn't used if you're using threaded or hybrid mode to view the thread.
Reply With Quote
  #10  
Old 09-10-2012, 01:54 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, all.
Nearly there.
Is there a GLOBALS variable which stores the number of posts being displayed? I.e. visible posts? I ask because I only want the system to 'prepare' the banners for the actual number which will be displayed.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.12766 seconds
  • Memory Usage 2,280KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (3)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete