Click to See Complete Forum and Search --> : Dynamic Table layout problem
kproc
11-10-2006, 09:53 AM
Hi
I have a webpage that is divided into three columns (left,center,right) the layout is done using css.
I'm having some problems with page layout when the page populates with the data.
Firefox displays the information onto the next column and explore sends the column to the bottom of the page (the problem only occurs when screen resultion is set to 800X600).
I need to some how limit the number of charecters per table cells or resize the table so that it always fits within table column.
any ideas how to acomplish this.
so_is_this
11-10-2006, 10:46 AM
You must be constructing the HTML incorrectly. I've never seen either browser "mess" up like that when the browser window width is changed. The only thing I've seen is that the table will get squished down to a certain point and then the horizontal scrollbar appears on the window and the right side of the table starts going out of sight. Even then, data never moves into the next column.
Sounds like maybe you've got a bunch of individual tables and these are shifting differently in each browser. If that is the case, then you just need judicious use of the following CSS:
style="float:left;"
kproc
11-10-2006, 11:14 AM
this is starting to turn into more of a css discussion then a php issue but none the less
The table width is set to 90%. the problem is if the text that is being added to the table cell is longer then the available width then it forces the table wider instead of moving to the next line. This problem only occurs with tables if there is only text then there is no issue
sitehatchery
11-10-2006, 11:28 AM
Can you provide a url?
so_is_this
11-10-2006, 12:09 PM
This problem only occurs with tables if there is only text then there is no issue
Again, I normally see text flow within table cells just fine in both browsers as the table automatically narrows down to a certain point while the browser window is resized to a narrower position. Are you sure you don't have width settings on one or more of your table rows (tr) or cells (th/td)?
bokeh
11-10-2006, 12:17 PM
This happens when a string of characters that does not include spaces is longer than it is possible to fit in a table cell. My advice to you is not to use tables at all.
kproc
11-10-2006, 01:02 PM
my webpage is
familyclick.ca
What can I do instead of using tables. all my pages are dynamic in some way
from what I read tables seemed easiest
so_is_this
11-10-2006, 01:12 PM
So, as mentioned, is this a case of a non-broken string of characters being too long?
kproc
11-10-2006, 01:29 PM
yes,
how could I get it to do a line break if the table cell exceeds X charters
sitehatchery
11-10-2006, 03:33 PM
Could this help?
http://www.php.net/manual/en/function.strlen.php
bokeh
11-10-2006, 03:46 PM
Or use wordwrap().
sitehatchery
11-10-2006, 03:55 PM
Here is a good discussion on this:
http://www.webdeveloper.com/forum/showthread.php?t=117656&highlight=wordwrap
If the paragraph is large, you can break it up into segments.
kproc
11-10-2006, 10:19 PM
IU tried this and it does nothing, what am I doing wrongn
<? echo wordwrap($email_address, 15, "<br />\n"); ?>
so_is_this
11-10-2006, 11:14 PM
To force a long string to be broken, you must specify the fourth argument (as 1) to that function. I found this note in the PHP manual (left by a reader of the manual):
If you're having problems with a small fixed width table/table cell being stretched by people typing entering long text (such as a URL or an email address), then one (MSIE only, unfortunately) solution is to use style="table-layout:fixed" in the <table> tag. This will break any words that would normally expand your table and mess up your layout. wordwrap() can't help in this situation because you want to wrap if the text is wider than X pixels, rather than X characters, which of course PHP has no way of knowing.
kproc
11-11-2006, 07:54 AM
thank you for the help. I tried the table fixed but nothing happens. the wordwrap seems to be doin g the trick
so_is_this
11-11-2006, 08:14 AM
I tried the table fixed but nothing happens.
The note did say IE-only (i.e., no help in your IE vs. Firefox situation) and, then again, no telling how accurate the note is in that regard. Adding the 1 as the fourth argument is the only sure-fire method -- as long as you don't mind your text never being able to expand (unless you conditionally apply the fourth argument in your PHP code).