Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Simulating columns?

Reply
Thread Tools

Simulating columns?

 
 
Bone Ur
Guest
Posts: n/a
 
      11-04-2007
Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007 02:53:32
GMT Jonathan N. Little scribed:

> I think dorayme is right here, server-side would have no idea what
> available size with respect to the browser. I think it would require
> some nasty JavaScript to calculate the available space and reposition
> the contents. And of course would also have to hook the onresize to do
> the process all over again if the user resizes the browser... yuck!


Not necessarily. One could use string-length of (record/row), converting
the max to an em number with a reasonable amount of leeway/slop, then float
the tables/containers themselves. The number of containers would be to
taste, -sensible, of course, and their max-width would need to be a
suitable fraction of typical screenwidth. This might break with super-
large font-sizes, but most things do, anyway.

--
Bone Ur
Cavemen have formidable pheromones.
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-04-2007
Bone Ur wrote:
> Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007 02:53:32
> GMT Jonathan N. Little scribed:
>
>> I think dorayme is right here, server-side would have no idea what
>> available size with respect to the browser. I think it would require
>> some nasty JavaScript to calculate the available space and reposition
>> the contents. And of course would also have to hook the onresize to do
>> the process all over again if the user resizes the browser... yuck!

>
> Not necessarily. One could use string-length of (record/row), converting
> the max to an em number with a reasonable amount of leeway/slop, then float
> the tables/containers themselves. The number of containers would be to
> taste, -sensible, of course, and their max-width would need to be a
> suitable fraction of typical screenwidth. This might break with super-
> large font-sizes, but most things do, anyway.
>


But you cannot get the browser viewport via server-side. This is a
client-side job. Also you need to know the height, not the width inorder
to "wrap" to the next column as the OP wishes...more fun...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      11-04-2007
Gazing into my crystal ball I observed dorayme
<(E-Mail Removed)> writing in news:doraymeRidThis-
http://www.velocityreviews.com/forums/(E-Mail Removed):

> In article <Xns99DDB5B2C4F8Carbpenyahoocom@69.28.186.121>,
> Adrienne Boswell <(E-Mail Removed)> wrote:
>
>> Gazing into my crystal ball I observed dorayme
>> >>
>> >> 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.

>
> I have a web page of all the postcodes in Australia. The html
> page has more than 17000 lines. I find it very convenient on one
> page! For one thing, one does not even need a menu. Searching the
> page is dead simple (command F and type first letters of town), I
> love it for its artlessness <g>. Yes, an internal menu that was
> fixed might also be nice to get to the different states but
> anyway... I mention not as a pure aside. If you accept that
> sometimes it is convenient to have a lot of stuff on a page,
> there is the question of a fluid design that will get as much of
> it as will fit on the screen and be convenient to read.


I agree that Ctrl-F or Command F is very simple, but I wonder how many
people really know to use that, or if they would think to do that. I
do, and I love Opera's find in page widget (I use it for Google's cache
all the time).

For example:
SELECT vendor_name, address, city_name, state_abbr, zipcode, phone, fax,
email, product_name, description, category, classification
FROM vendors v, categories c, classicifications cl, products p
WHERE v.id = p.vendor_id
AND p.category_id = c.id
AND p.classification_id = cl.id
AND city_name = 'Los Angeles'
ORDER BY product_name

A query like this could result in thousands of records, a very large
record set. Of course, I put it into an array and close the record set
right away. Still, that's a lot a looping. If you have to loop through
an open recordset, it's even worse.

>
> Correct me if I am wrong, your suggestion is to grab the items in
> the list and divide them up into fixed-beforehand numbers of
> items per ul. And float the ul's. Indeed, this would be fluid and
> convenient if the lists were roughly the same length (the number
> of items in a list cannot guarantee this, and I don't think
> server side is good at semantics. I suppose there could be a
> check on list size length built in and so on).


Yes, because when putting something like this into an array, you can
find out the number of items in the array. I would prefer to do that
than open one recordset to get a count, and another to get the records.

>
> I was interested in this, Adrienne, because I did (but by hand) a
> slightly similar thing for a page a while back which was broken
> into blocks that floated and was not too bad in using up the
> available space, there would be "wrapping" according to view port
> width. I carefully arranged the floats based on length so they
> would not snag in an ugly way when wrapped (by having the lists
> go in size order, smallest first.
>


Much easier to do it server side. Find out the total, and divide
accordingly. I do most of my developing in ASP, and I'm tired tonight,
otherwise, I'd give you a little sample.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      11-04-2007
Gazing into my crystal ball I observed "Jonathan N. Little"
<(E-Mail Removed)> writing in
news:fab3$472d410a$40cba7c4$(E-Mail Removed):

> Bone Ur wrote:
>> Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007
>> 02:53:32 GMT Jonathan N. Little scribed:
>>
>>> I think dorayme is right here, server-side would have no idea what
>>> available size with respect to the browser. I think it would require
>>> some nasty JavaScript to calculate the available space and
>>> reposition the contents. And of course would also have to hook the
>>> onresize to do the process all over again if the user resizes the
>>> browser... yuck!

>>
>> Not necessarily. One could use string-length of (record/row),
>> converting the max to an em number with a reasonable amount of
>> leeway/slop, then float the tables/containers themselves. The number
>> of containers would be to taste, -sensible, of course, and their
>> max-width would need to be a suitable fraction of typical
>> screenwidth. This might break with super- large font-sizes, but most
>> things do, anyway.
>>

>
> But you cannot get the browser viewport via server-side. This is a
> client-side job. Also you need to know the height, not the width
> inorder to "wrap" to the next column as the OP wishes...more fun...
>


Getting the height is simple, for example, let's say you have a maximum
of 30 items in your record set. I do most of my development in ASP, so
here it is in ASP.

set rs = createobject("ADODB.Recordset")
rs.Open sql, oconn

if not rs.EOF then
rsarr = rs.getrows()
end if
rs.Close
set rs = nothing 'destroy the recordset
connection.close
set connection = nothing 'destroy the connection to the db


breakrow = ubound(rsarr,2)/2

for i = 0 to breakrow
%>
<li><%=rsarr(0,i)%></li>
<%
next
%>
</ul>
<ul>
<% for i = breakrow+1 to ubound(rsarr,2)%>
<li><%=rsarr(0,i)%></li>
<%
next
%>
</ul>



--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-04-2007
Adrienne Boswell wrote:
> Gazing into my crystal ball I observed "Jonathan N. Little"
> <(E-Mail Removed)> writing in
> news:fab3$472d410a$40cba7c4$(E-Mail Removed):
>
>> Bone Ur wrote:
>>> Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007
>>> 02:53:32 GMT Jonathan N. Little scribed:
>>>
>>>> I think dorayme is right here, server-side would have no idea what
>>>> available size with respect to the browser. I think it would require
>>>> some nasty JavaScript to calculate the available space and
>>>> reposition the contents. And of course would also have to hook the
>>>> onresize to do the process all over again if the user resizes the
>>>> browser... yuck!
>>> Not necessarily. One could use string-length of (record/row),
>>> converting the max to an em number with a reasonable amount of
>>> leeway/slop, then float the tables/containers themselves. The number
>>> of containers would be to taste, -sensible, of course, and their
>>> max-width would need to be a suitable fraction of typical
>>> screenwidth. This might break with super- large font-sizes, but most
>>> things do, anyway.
>>>

>> But you cannot get the browser viewport via server-side. This is a
>> client-side job. Also you need to know the height, not the width
>> inorder to "wrap" to the next column as the OP wishes...more fun...
>>

>
> Getting the height is simple, for example, let's say you have a maximum
> of 30 items in your record set. I do most of my development in ASP, so
> here it is in ASP.
>
> set rs = createobject("ADODB.Recordset")
> rs.Open sql, oconn
>
> if not rs.EOF then
> rsarr = rs.getrows()
> end if
> rs.Close
> set rs = nothing 'destroy the recordset
> connection.close
> set connection = nothing 'destroy the connection to the db
>
>
> breakrow = ubound(rsarr,2)/2
>
> for i = 0 to breakrow
> %>
> <li><%=rsarr(0,i)%></li>
> <%
> next
> %>
> </ul>
> <ul>
> <% for i = breakrow+1 to ubound(rsarr,2)%>
> <li><%=rsarr(0,i)%></li>
> <%
> next
> %>
> </ul>
>
>
>


Not sure where in there you get the height of the available space in
order to break the recordset into columns....

And if the user resizes his browser window after the page renders?

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Ciaran
Guest
Posts: n/a
 
      11-04-2007
Hi all, thanks for the replies on this. The way I've done it in the
past is to group the elements into smaller categorised lists and float
them left. As Dorayme mentioned earlier, I would arrange the lists
shortest to longest to avoid ugly wrapping problems. The problem is,
this technique only works when the order of the lists is not
important.

Another method I've used is Adrienne's solution of getting the total
items and divide them up based on the space available. The problem is,
it's messy to code and doesn't really cater for various screen
resolutions.

In my current case, I'd like to keep the lists in the original order
where possible. I know there's no quick solution but I do this sort of
stuff so often, I would be great to find any answer to the problem!

I may as well give you the url I'm working on - It's a bit of a mess
at the moment as I have the lists floated left and the containers they
are in are shrinking to default height.

http://www.scouttalk.ie/0pages/libraryindex.php
Cheers
Ciarán

 
Reply With Quote
 
Bone Ur
Guest
Posts: n/a
 
      11-04-2007
Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007 03:48:34
GMT Jonathan N. Little scribed:

>>> I think dorayme is right here, server-side would have no idea what
>>> available size with respect to the browser. I think it would require
>>> some nasty JavaScript to calculate the available space and
>>> reposition the contents. And of course would also have to hook the
>>> onresize to do the process all over again if the user resizes the
>>> browser... yuck!

>>
>> Not necessarily. One could use string-length of (record/row),
>> converting the max to an em number with a reasonable amount of
>> leeway/slop, then float the tables/containers themselves. The number
>> of containers would be to taste, -sensible, of course, and their
>> max-width would need to be a suitable fraction of typical
>> screenwidth. This might break with super- large font-sizes, but most
>> things do, anyway.
>>

>
> But you cannot get the browser viewport via server-side. This is a
> client-side job. Also you need to know the height, not the width
> inorder to "wrap" to the next column as the OP wishes...more fun...


Hehe, I had to go back and re-read the original post because I forgot the
stated goal.

The OP doesn't _really_ want columns at all; he wants floating divs of
equal width which "columnize" in an aligned manner filling more of the
horizontal area of the page. At least that's what I get from the
message, and doing it is possible with j/s (except maybe for ie.)
Knowing the viewport size beforehand isn't necessary though the floats
will have to be widthed (in ems) beforehand with care.

The technique has been addressed before on the newsgroup. As I said,
though, this is what I glean from the first post. Maybe I missed
something in the interim.

--
Bone Ur

When I was a young man I learned that having sex with a woman is fun
until you either get caught or married.
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-04-2007
Bone Ur wrote:

> Hehe, I had to go back and re-read the original post because I forgot the
> stated goal.
>
> The OP doesn't _really_ want columns at all; he wants floating divs of
> equal width which "columnize" in an aligned manner filling more of the
> horizontal area of the page. At least that's what I get from the
> message, and doing it is possible with j/s (except maybe for ie.)
> Knowing the viewport size beforehand isn't necessary though the floats
> will have to be widthed (in ems) beforehand with care.
>
> The technique has been addressed before on the newsgroup. As I said,
> though, this is what I glean from the first post. Maybe I missed
> something in the interim.
>


You might be right. Hard to say now. Sometimes the OP's "root" questions
is hard to decipher.

If it is just floating blocks, then work out a value for the width in
ems of the UL to accommodate the longest LI entry, if you do not want
line wrapping, and float with margins to taste! Easy...no scripting at
all required.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Bone Ur
Guest
Posts: n/a
 
      11-04-2007
Well bust mah britches and call me cheeky, on Sun, 04 Nov 2007 17:32:29
GMT Jonathan N. Little scribed:

>> Hehe, I had to go back and re-read the original post because I forgot
>> the stated goal.
>>
>> The OP doesn't _really_ want columns at all; he wants floating divs
>> of equal width which "columnize" in an aligned manner filling more of
>> the horizontal area of the page. At least that's what I get from the
>> message, and doing it is possible with j/s (except maybe for ie.)
>> Knowing the viewport size beforehand isn't necessary though the
>> floats will have to be widthed (in ems) beforehand with care.
>>
>> The technique has been addressed before on the newsgroup. As I said,
>> though, this is what I glean from the first post. Maybe I missed
>> something in the interim.
>>

>
> You might be right. Hard to say now. Sometimes the OP's "root"
> questions is hard to decipher.
>
> If it is just floating blocks, then work out a value for the width in
> ems of the UL to accommodate the longest LI entry, if you do not want
> line wrapping, and float with margins to taste! Easy...no scripting at
> all required.


Arghh!! Yeah, I meant "...it is possible withOUT j/s..."

Floating blocks would probably suffices (again, according to the text of
the orig. post.)

--
Bone Ur

When I was a young man I learned that having sex with a woman is fun until
you either get caught or married.
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      11-04-2007
In article
<(E-Mail Removed). com>,
Ciaran <(E-Mail Removed)> wrote:

> Hi all, thanks for the replies on this. The way I've done it in the
> past is to group the elements into smaller categorised lists and float
> them left. As Dorayme mentioned earlier, I would arrange the lists
> shortest to longest to avoid ugly wrapping problems. The problem is,
> this technique only works when the order of the lists is not
> important.
>
> Another method I've used is Adrienne's solution of getting the total
> items and divide them up based on the space available. The problem is,
> it's messy to code and doesn't really cater for various screen
> resolutions.
>
> In my current case, I'd like to keep the lists in the original order
> where possible. I know there's no quick solution but I do this sort of
> stuff so often, I would be great to find any answer to the problem!
>
> I may as well give you the url I'm working on - It's a bit of a mess
> at the moment as I have the lists floated left and the containers they
> are in are shrinking to default height.
>
> http://www.scouttalk.ie/0pages/libraryindex.php
> Cheers
> Ciarán


You will have read all the suggestions, you will appreciate the
messing about you could go to to get 'close to' your original
goal. But frankly, consider seriously not bothering and saving
yourself a lot of work and a lot of problems. Just have your
lists in one columns that needs to be 'linked into' or 'scrolled
through' or 'keyboard paged downed to'. In another column, you
can have other useful things, *especially* a menu that will be
visible when the page opens to link to the various lists you have
below under the headings: Song books, Ghost, Games etc.

Instead of battering away at a fixed idea of a layout and trying
to solve all the problems with that, question the idea itself and
think of things on the whole. In this case, consider seriously
the above suggestion and avoid yourself the headaches. I believe
your viewers would be advantaged on the whole too.

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulating testbench waveform error: "No feasible entries for subprogram write" Taras_96 VHDL 2 08-03-2005 02:55 AM
Problem simulating Xilinx CoreGenerator Cores with ModelSim SE 5.8C. Jeremy Webb VHDL 2 10-23-2004 01:56 AM
Simulating Bidirectional Pins - How is it displayed? Drew VHDL 1 07-26-2004 01:34 PM
Simulating VHDL design with ModelSim Modukuri VHDL 7 06-01-2004 08:07 PM
problem with simulating a program DG VHDL 3 10-11-2003 09:26 AM



Advertisments