Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd or Even?

Status
Not open for further replies.

metaphiz

Programmer
Jun 30, 2004
91
US
I'm setting up a page that uses URL parameters to name images dynamically. I want to break the line every 2 images. So I'm planning on setting up an ImageCount variable that counts the images.

I figure the easiest way to know when to break the line and when to just put the next image on the same line would be to evaluate whether the ImageCount is even or odd. If it's odd, then put one more image on the line. If it's even, start a new row.

I don't see any CF function to evaluate even or odd, so I figure I can just check to see if it's divisible by 2 to see if it's even, like:

If ImageCount/2 = Integer, make a new row
If imageCount/2 IS NOT an Integer, add next image to this row

But I don't see a function to evaluate if it's an integer, either. Am I on the right track? Is there an easier way? Is there something similar to an IsInteger() function like with IsDate() ?
 
just do a
<cfif ImageCount mod 2>
your code here
cfelse>
your code here
</cfif>

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top