Go Back   vb.org Archive > Community Discussions > Forum and Server Management
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2011, 11:10 AM
DanTHEGREAT's Avatar
DanTHEGREAT DanTHEGREAT is offline
 
Join Date: Oct 2008
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to calculate?

I basically want under my postbit template to say

Posts: X
Raffle Tickets: X (number)

But in order to get that number, I want it to calculate Raffle Tickets by posts / 20

How would I go about doing this?

Sorry, I'm a programmer and this seems really easy to make in C++ or Java but not sure with php and html.

Thanks
Reply With Quote
  #2  
Old 04-25-2011, 04:31 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What are Raffle Tickets? They are not a default vbulltin thing. You should ask this question in the modification thread where you downloaded the modification.
Reply With Quote
  #3  
Old 04-25-2011, 04:43 PM
DanTHEGREAT's Avatar
DanTHEGREAT DanTHEGREAT is offline
 
Join Date: Oct 2008
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Its not a modification. Every 20 posts a member makes creates 1 raffle ticket SO,

the equation is:

Raffle = Posts / 20 (truncate decimal)

EXAMPLE:
Raffle = 40 / 20
Raffle= 2.

Display:
Posts: 40
Raffles: 2
Reply With Quote
  #4  
Old 04-25-2011, 04:51 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do raffle tickets go away at any point?
Reply With Quote
  #5  
Old 04-25-2011, 06:58 PM
Artistichaven Artistichaven is offline
 
Join Date: Feb 2011
Posts: 44
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That doesn't make sense. Let's say we have 3 users. A, B, and C. A has 20 posts and thus one raffle ticket. B has 10 posts and no raffle tickets. C has 15 posts and no raffle tickets.

Total posts = 45
Total raffle tickets = 1

if (totalPosts%20 > 9)
(posts/20) - 1 = 2 (rounded)
else
posts/20 = 2 (rounded)
^Still inaccurate according to my above example.

2 != 1

Also, go into your statistics template and get the variable. ($totalposts)
Reply With Quote
  #6  
Old 04-25-2011, 07:38 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DanTHEGREAT View Post
Its not a modification. Every 20 posts a member makes creates 1 raffle ticket SO, ...
You don't say if you're using vb3 or vb4, but in vb3 although you can't put php in a template, you can cheat by using the side-effect of a condition, like

Code:
<if condition="$post['tickets'] = (int)($post['posts'] / 20)"></if>
Total raffle tickets = $post[tickets]
The same thing might work in vb4 with the appropriate tags, I don't know - or maybe there's a better way to do it in vb4.
Reply With Quote
  #7  
Old 04-25-2011, 08:11 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you use (int) in a template like that?
Reply With Quote
  #8  
Old 04-25-2011, 08:27 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
Can you use (int) in a template like that?
It seems to work. In fact after I posted this I tried it in vb 4.1.3 and it works there too. I just started working with vb4, I was disappointed to find it didn't work with the vb:math tag - I'm not sure why since there's little documentation in the manual. I guess it doesn't allow parens at all or something.
Reply With Quote
  #9  
Old 04-25-2011, 08:38 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you mean parenthesis? I use those in conditional for wrapping some conditions and they seem to work fine. Unless I got your meaning wrong.

They use the math in the style vars, though. Not that that would mean anything.

How's this for some screwed up code?

Code:
if ((int)round(abs($postdays)) > 1)
Reply With Quote
  #10  
Old 04-25-2011, 09:10 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
Do you mean parenthesis?
Yeah, I'm just lazy. I meant they don't seem to work in the vb:math tag. But I'm probaby like, what, a year and a half behind everyone else figuring that out.
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 12:20 AM.


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.04698 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete