Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 25 Apr 2011, 13:10
DanTHEGREAT's Avatar
DanTHEGREAT DanTHEGREAT is offline
 
Join Date: Oct 2008
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
__________________
www.AnsherEnterprise.com
FREE hosting for your vBulletin website
Reply With Quote
  #2  
Old 25 Apr 2011, 18:31
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Real name: Lynne
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.
__________________
Former vBulletin.org Staff Member

Try a search before posting for help. Many users won't, and don't, help if the question has been answered several times before.
W3Schools -
Online vBulletin Manual
If I post some CSS and don't say where it goes, put it in the additional.css template.
I will NOT help via PM (you will be directed to post in the forums for help.)
Reply With Quote
  #3  
Old 25 Apr 2011, 18:43
DanTHEGREAT's Avatar
DanTHEGREAT DanTHEGREAT is offline
 
Join Date: Oct 2008
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
__________________
www.AnsherEnterprise.com
FREE hosting for your vBulletin website
Reply With Quote
  #4  
Old 25 Apr 2011, 18:51
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Real name: Zachery Woods
Do raffle tickets go away at any point?
__________________
Looking for ImpEx?
Reply With Quote
  #5  
Old 25 Apr 2011, 20:58
Artistichaven Artistichaven is offline
 
Join Date: Feb 2011
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)

Last edited by Artistichaven; 25 Apr 2011 at 21:06.
Reply With Quote
  #6  
Old 25 Apr 2011, 21:38
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by kh99; 26 Apr 2011 at 02:37.
Reply With Quote
  #7  
Old 25 Apr 2011, 22:11
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Can you use (int) in a template like that?
Reply With Quote
  #8  
Old 25 Apr 2011, 22:27
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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 25 Apr 2011, 22:38
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
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?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #10  
Old 25 Apr 2011, 23:10
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 00:52.

Layout Options | Width: Wide Color: