Well you didn't say you wanted a dynamic number of columns...
Well I did* but thanks to yourself and Ralph I have what I'm looking for
now, thanks very much. Much appreciated.
adam
* "Obviously if the number of items and columns are static, I have no
problem, but how do I get a layout that app
...)
Martin
> -Original Message-
> From: Matt Grimm [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 8 January 2004 9:37 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Sorting data into columns vertically
>
>
> Well you didn't say you wanted a dynamic number of colum
Ok, I think this is more what you're looking for. Dynamic columns *and*
rows. This work for ya?
// How many columns do you want?
$l_iColumnWidth = 6;
// Populate an array of random length with random values
for ($i = 0; $i < rand(15, 300); $i++) {
$l_aTest[] = '...';
}
$l_iLength = count($
Well you didn't say you wanted a dynamic number of columns...
What's the problem with the solution 102, 101, 101? That's the count of the
elements in each column -- you said in a 7 member array, you wanted 3 items
in the first column, and two in the other two columns. That's 3, 2, 2,
which the c
I get:
Your columns are: 102, 101, 101
???
The other problem with this solution is that it's for a static number of
columns, however I'm looking for a solution with dynamic variables. For
example, I might want 4 columns with 100 items, or six columns with 15.
Thanks for trying though.
adam
> $l_iSecond = ($l_iMod < 2 ? $l_iHigh - $l_iMod : $l_iHigh);
This should actually be:
$l_iSecond = ($l_iMod == 1 ? $l_iHigh - $l_iMod : $l_iHigh);
but it works both ways.
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK
Try this:
// Populate an array of random length
for ($i = 0; $i < rand(300, 600); $i++) {
$l_aTest[] = '...';
}
$l_iLength = count($l_aTest);
$l_iLow = floor($l_iLength / 3);
$l_iHigh = ceil($l_iLength / 3);
$l_iMod = $l_iLength % 3;
$l_iFirst = $l_iHigh;
$l_iSecond = ($l_iMod < 2 ? $l_iHigh
7 matches
Mail list logo