To throw a huge spanner in the works:

1. tables are not intended for layout

2. devices other than a PC/Windows web browser may be more suited to q well structured XHTML based, table-less format with CSS for styling.

3. columns work well in a newspaper, but do not translate well to the web, since you have no idea where the bottom of the screen is... who wants to scroll down, only to discover this is half or one third of the text, having to scroll up again???


IF ANYTHING, structure/style your columns using DIVs/CSS, NOT tables... that way, for accessibility purposes, the content is still readable when read top-to-bottom, via something like a PDA, mobile/cell phone, text-to-speach converter, etc.



Yes, i use columns in layout, but NOT to discuss one topic... each column is a div, and each div is styled with CSS to look like a column when styled, and each div discusses one topic... a long article would not be spread across two divs... this is a structural nightmare!!!


You are trying to emulate another medium (print), rather than embracing another (web) which has a different set of rules.


If you must break the text into two columns, try to do it with divs and style sheets, not tables, so that it's structurally not too far out of normal reading.



Really though, do your readers want/need this???



I hate to think how bad this sort of ugly mark-up prints out!!!



Justin







On Wednesday, August 27, 2003, at 03:10 AM, Dynamical.biz wrote:


Hi, I've been dealing withs this question:

I've never seen dynamical balanced text in two colums in a web so this the
challenge.


html formated text is stored in a database, conetion and placed into a
variable i.e.:
$text = "<P><IMG alt="labordeta" hspace=3
src="http://www.lamundial.net/img/labordeta.jpg"; align=left
border=0><EM>efe.Zaragoza.</EM> El parlamentario.</P><P>Some more text
tranquilo simplenente trabajando.</P>"; ... some more paragrphs just like
newspaper articles.


the first idea is this:
1. count the total characters in $text string so we can guess juts the half
2. getting into $tx1 variable the fisrt half
3. count the total characters in $tx1 till the fisrt "</p>" STARTING from
the END to the BEGUINING of $tx1
4. getting into $col1 the fist part
5. getting into $col2 the rest
6. render the text in a table


//CODE
1. $half = floor(strlen($texto)/2);
2. $tx1 = substr($text,0,$half);
3. $first_P = strrpos($tx1,"</P>");

4. $col1 = substr($text,0,$first_P);
5. $col2 = substr($text,$first_P);
6.
<table>
  <tr>
    <td><?= $col1 ?></td>
    <td><?= $col2 ?></td>
  </tr>
</table>

PROBLEMS
easy to know the middle point of a string but we have html code so easy to
break it badly, something like:
<IMG hspace=3 src="ht <-|-> tp://www.lamundial.net/img/img.jpg"> so this is
why the </p> idea.


If there is a large paragrph in the middle of the whole text the columns the
two columns are not so nice balanced, this is why I ask the people writing
articles for my web trying to avoid looooong ones. They use HTMLAREA
http://www.interactivetools.com/products/htmlarea/ from Interactive tools so
the html is not done by hand.


anyway just in case there is no way to correctly balance the text I let the
writer the "1 colum / 2 colums" as an option so the traditional 1 colum (no
colums) is always available. they can display the final render os the
article as they save it when writing so the decide.


this is working at most of the articles in
http://www.lamundial.net

i.e.:
http://www.lamundial.net/home.php?pg=article&idart=124
http://www.lamundial.net/home.php?pg=article&idart=121
http://www.lamundial.net/home.php?pg=article&idart=118

the text balancing is working quite nice


any other idea? thanks



aniceto lópez
DYNAMICAL.BIZ
web development
host services

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

---
[This E-mail scanned for viruses]



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to