Page 1 of 1

Pretty basic maths question [SOLVED]

Posted: Tue Mar 06, 2007 9:45 pm
by Stryks
At least I think it is. I'm useless at maths.

Anyhow, I've got an array filled with filenames, built by pulling a file list from a directory structure, and I'm using it to display files found (images) in a gallery page.

I'm pretty much set up, with 3 images across (generated thumbnails) and I'm looking at 4 rows.

So ... my simple question is, how do I go about getting the number of times 12 goes into the number of array elements without a remainder.

I mean, I can find the remainder easily enough with something like

Code: Select all

if($img_count % 12)  $page_count++;
to increase the page count to cover the extra images.

I just dont know how to get how many base pages it will take. :oops:

Any help?

Posted: Tue Mar 06, 2007 9:51 pm
by Stryks
Damn ... thats embarrassing.

I worked it out just after I posted it.

Code: Select all

$page_count = (($img_count - ($img_count % 12)) / 12);
			if($img_count % 12)  $page_count++;
Thanks