[PHP] Re:[PHP] dynamical balancing text in two colums
Hello Just asking why do you want to split at paragraphs? Couldn't you just simply look for a word boundary and then split the columns? You could exclude tags from the split meaning wordboundaries cannot be inside that way no breaking of tags. Since the result is checked by a human they can easily change the appearance by including breaks as needed. So simply do your half split and than work your way back to the first word boundary. That should give a fairly balanced column. Regards Stefan Langer
RE: [PHP] dynamical balancing text in two colums
Yes I concidered split at words, the colum balancing was better 'numericali' but most of the times at the end of the first colum you can find some few wprds (one or two) the rest of the line in white and the sentence continues at the begining of the second colum and it's a bit strange to find when reading a splited sentence if the end of the first part doen't touch the right margin of the first col. (hard to explain this in words, sorry if it's not so clear) --this is no good col 1 col 2 sdf sf dff asdf s 'second' sd df s asdf as sffadf asd sdfs dfsd sdf sd sdd dsddd fgf rt g gh g dfgh ddfh 'first'fsdf s ddf sdf bad--| --this is the nice one col 1 col 2 sdf sf dff asdf s 'second' sd df s asdf as sffadf asd sdfs dfsd sdf sd sdd dsddd fgf rt g gh g dfgh ddfh d sd dd sd 'first' fsdf s ddf sdf good| Also concidered to let the writer include some strange character combination so the point for spliting can be fully controlled but something I don't like is force content editors to do 'strange things'. They just write in Htmlarea http://www.interactivetools.com/products/htmlarea/, format a bit the text like using Word or any other typical one and that's all. anyway I guess there is no way to simulate the best (like in printed media) but I decided to break in paragraphs to keep some kind of coherency. someboy told in this forum that two cols was not god in screen media as we usualy read from top to botton avoiding scrolling. yes that right but we also have the habit to scroll (visually) when reading printed text and I like the idea of doing something new if it's not so bad. In my web www.lamundial.net not comercial is where I can test this kind of things without 'economical' risc thanks Stefan for your interest aniceto lopez :: DYNAMICAL.BIZ web development host services Barcelona - Spain -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Enviado el: miercoles, 03 de septiembre de 2003 11:00 Para: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Asunto: Re:[PHP] dynamical balancing text in two colums Hello Just asking why do you want to split at paragraphs? Couldn't you just simply look for a word boundary and then split the columns? You could exclude tags from the split meaning wordboundaries cannot be inside that way no breaking of tags. Since the result is checked by a human they can easily change the appearance by including breaks as needed. So simply do your half split and than work your way back to the first word boundary. That should give a fairly balanced column. Regards Stefan Langer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamical balancing text in two colums
We tried something like this in the spring. If the paragraphs are uniform in length you can get columns roughly balanced - but never with a high degree of certainty. We also knew our subscribers would be printing out the copy, and that's where we gave up on two column layout, as we had no control over the sheet size, font size, etc. If an article extended over two pages, you had to read the first colum to the bottom, turn the page and keep reading to the end of the column, then flip back and start reading the second column. I suppose one could get closer, but look at the desktop publishing programs - apart from FrameMaker, you have to flow and place text by hand. To do it we'd be counting lines, adjusting for heads and bylines, and hoping, hoping, hoping it would not look too disgraceful. So we bailed out - the subscriber could read it online, with a decent line lenght in a Flash movie, or accept typewriter like printout extending across the page. What made that decision easier was a survey which indicated that over 90% of subscribers read it on line and did not print it. Cheers - Miles Thompson At 07:10 PM 8/26/2003 +0200, 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 = PIMG alt=labordeta hspace=3 src=http://www.lamundial.net/img/labordeta.jpg; align=left border=0EMefe.Zaragoza./EM El parlamentario./PPSome 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 long 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=articleidart=124 http://www.lamundial.net/home.php?pg=articleidart=121 http://www.lamundial.net/home.php?pg=articleidart=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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamical balancing text in two colums
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 = PIMG alt=labordeta hspace=3 src=http://www.lamundial.net/img/labordeta.jpg; align=left border=0EMefe.Zaragoza./EM El parlamentario./PPSome 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 long 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=articleidart=124 http://www.lamundial.net/home.php?pg=articleidart=121 http://www.lamundial.net/home.php?pg=articleidart=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
RE: [PHP] dynamical balancing text in two colums
Thanks Justin and Miles for your ideas. It can take a looong time and a huge quantity of beer to disscuss them. I was asking for some other ideas just about the code, how to solve this problem technicaly not if this is a good idea to use one / two colums, tables or DIVS, print vs screen etc. thanks anyway saludos aniceto lópez :: DYNAMICAL.BIZ web development host services Barcelona - Spain -Mensaje original- De: Justin French [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 27 de agosto de 2003 15:06 Para: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Asunto: Re: [PHP] dynamical balancing text in two colums 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 = PIMG alt=labordeta hspace=3 src=http://www.lamundial.net/img/labordeta.jpg; align=left border=0EMefe.Zaragoza./EM El parlamentario./PPSome 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 long 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=articleidart=124 http://www.lamundial.net/home.php?pg=articleidart=121 http://www.lamundial.net/home.php?pg=articleidart=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
[PHP] dynamical balancing text in two colums
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 = PIMG alt=labordeta hspace=3 src=http://www.lamundial.net/img/labordeta.jpg; align=left border=0EMefe.Zaragoza./EM El parlamentario./PPSome 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 long 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=articleidart=124 http://www.lamundial.net/home.php?pg=articleidart=121 http://www.lamundial.net/home.php?pg=articleidart=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