|
Posted by Adrienne Boswell on 11/04/07 00:52
Gazing into my crystal ball I observed dorayme
<doraymeRidThis@optusnet.com.au> writing in news:doraymeRidThis-
33C789.10473604112007@news-vip.optusnet.com.au:
> In article <Xns99DDA8FA22316arbpenyahoocom@69.28.186.121>,
> Adrienne Boswell <arbpen@yahoo.com> wrote:
>
>> Gazing into my crystal ball I observed dorayme
>> <doraymeRidThis@optusnet.com.au> writing in
>> news:doraymeRidThis-079A31.10290604112007@news-vip.optusnet.com.au:
>>
>> > In article <Xns99DDA01D8AFBFarbpenyahoocom@69.28.186.121>,
>> > Adrienne Boswell <arbpen@yahoo.com> wrote:
>> >
>> >> Gazing into my crystal ball I observed Ciaran
<cronoklee@hotmail.com>
>> >> writing in
>> >> news:1194092263.454782.316970@y42g2000hsy.googlegroups.com:
>> >>
>> >> > Hi,
>> >> > I have a very long dynamically generated bulleted list and I'd
like
>> >> > to make it display in columns rather than down the left and side
of
>> >> > the page. I know columns aren't available till CSS 3 but I was
>> >> > wondering if there's some current cross browser trick or hack
that
>> >> > might work for me?
>> >> >
>> >> > Cheers
>> >> > Ciarαn
>> >> >
>> >>
>> >> Server side - get the total items and divide by two. Then loop
>> >> through and when you reach that amount, end the list and start
>> >> another. Float the ul element.
>> >
>> > When you reach what amount?
>> >
>>
>> For example, say there are 20 items in a table. Run the query, get
the
>> recordset, and the count of items in the recordset. Put the
recordset
>> into an array. Close the record set.
>>
>> total_items = 20
>> breaknow = total_items/2
>>
>> loop though the array until you reach breaknow then end the list and
>> start another. If the total is not an even number, then the last
list
>> will have one extra item.
>
> Suppose there 400 items. Are you proposing a script that is alive
> to the browsers window size or just to split lists into groups of
> 10?
>
Personally, I would never put 400 items on a single page (even looping
through an array, and certainly not an open recordset), that's what
paging and good database design are about. The above is only an example
to show what _could_ be done with a dynamically generated list. If you
wanted, you could change the divisor based on the total records, eg. <20
=1, >20 and <60 = 2, >60 and <81 = 3, etc.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
[Back to original message]
|