TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Variable <if question

Page: 1 Reply
Jan 27th 2004#139770 Report
Member since: Mar 16th 2001
Posts: 2421
I'm using a variable for one of my skins.
[PHP][/PHP]

What I need to do is make that a range. Like say ==1 "thru" 30 or something. I know the answer has to be simple. But I'm an idiot ;) So I couldn't figure it out.
Reply with Quote Reply
Jan 27th 2004#139771 Report
Member since: Mar 24th 2002
Posts: 3114
$min = 0;
$max = 100;
if( $number < $max AND $number > $min){ do crap; }

Something like that should do it, or am I not getting what you're after?
Reply with Quote Reply
Jan 27th 2004#139794 Report
Member since: Mar 16th 2001
Posts: 2421
Not sure. The code above is actually inside one of the templates I set up. I don't know if I can actually add variable outside of that
Basically what I need is this.

[PHP] [/PHP]

I just need that == to be a range of like say 1-20
Reply with Quote Reply
Jan 27th 2004#139797 Report
Member since: Mar 24th 2002
Posts: 3114
well, my example should work, for all I can see.
Just replace the $number with $forum[forumid]. I can't see why you couldn't add your own two variables, min and max anywhere, as long as those variable names aren't taken elsewhere in the same script package.
Maybe you could post that part of the script so we could see how it's working exactly?
Reply with Quote Reply
Jan 27th 2004#139800 Report
Member since: Mar 18th 2001
Posts: 6632
Wouldn't you just use an array for that... http://perl.about.com/library/weekly/aa050703a.htm?PM=ss12_perl
Reply with Quote Reply
Jan 27th 2004#139814 Report
Member since: Apr 20th 2002
Posts: 3000
Erm, if the range remains constant whenever you use the condition, lets say 0 and 30 non-inclusive, you can just do:

[php]
// a modified paavo-answer
if ($forum[forumid] > 0 && $forum[forumid] < 30) do(something, or another);
[/php]

They're not magic numbers as long as they don't change, ;)

... I think.
Reply with Quote Reply
Jan 28th 2004#139822 Report
Member since: Mar 16th 2001
Posts: 2421
Yeah thanks guys, I'll try those out. If this were not vBulletin I would not have a problem doing this. It's just that the new version allows < if statements right inside of the templates. Calling an outside variable from within that template should'nt be a problem. It's just putting the variable in the right spot.
mo0's looks like it may be exactly what I am looking for. It sets all the requirements from within the < if statement itself which was sort of what I was trying to accomplish.

Pav, thanks for your input. I'm guessing that "would" work but the only issue is the external variable placement. That is why I was trying to keep everything self contained.

And thank you to Dek...
Reply with Quote Reply
Jan 28th 2004#139923 Report
Member since: Mar 29th 2003
Posts: 1326
dont you remember high school math?

solve tan 2x = 1 for 0 < x < 2pi

:D
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum