I'd like to avoid reinventing the wheel, so if anyone has a good solution for newspaper columns with CSS2, MySQL and PHP, I'd love to hear it. I'm building for my company, so I might be able to pay you for it.
Thanks!
Newspaper columns?
I'm not exactly sure what you mean about newspaper columns, but here are some excellent templates. If you don't find what you want there, then come back and I'm sure the people here can help you.
newspaper columns --- an explanation
Look at a newspaper. See how the fcolumns line up across the page. The text flows down one column, then started at the top of the next and flows down. It has to be dynamic. I'm not sure, but I don't think CSS2 supports this. Does anyone know how to do it in PHP?
Newspaper columns?
I could have sworn I saw a similar effect in the CSS2 spec. Apparently not.
The problem you're going to face working this way is lining the bottom of the columns up. You shouldn't really do fixed-height columns, as user agents render text differently (and users can have different default text sizes) - but then variable-length columns won't get the effect you want.
It'd be pretty easy to knock up a PHP script, count the number of words in the string to print out, divide by the number of columns - if you're feeling daring you could do it by the width of each character and get a really accurate spread of text.
Personally I'd consider whether a newspaper format would work on the internet - I personally wouldn't want to scroll down to the bottom of one column and scroll back up to the next - again, it's difficult to cater for all screen sizes, probably here at work (1280x1024) it'd be OK but some people still run 800x600 (640x480? hope not). But that last bit is just my opinion, I know nothing of the context you're going to use this in.
Newspaper columns?
Hi Chewmanfoo,
The real problem is that you don't know the length of each column.
If you can break the content into sections such as paragraphs that are approximately the same height or use php to estimate the size of each small block of content you should be able to get the look your after.
:idea: Why not use php to count characters, then each say 200 characters (just a number) find the next period and wrap that section in span tags.
Place them in an array for a moment, then divide the number in the array by the number of columns you want. The rest should be easy just lay them out into the columns.
You should end up with reasonably similar length columns.
Hope that helps.
All good responses - funny CSS2 doesn't have this
Thanks everyone! I did notice that in the CSS3 spec, there's support for this http://www.w3.org/TR/css3-multicol/ That's nice. Now, I'm taking bets on how long it will take for this option to appear in my favorite browser (mozilla.) Anyone want to wager?
Newspaper columns?
Good, I'm glad to know I didn't imagine reading that...
Newspaper columns?
I'd like to think it would be supported soon, but in reality I know it willl take a long time. Firstly you can count IE out for the next couple of years as no development for future versions will be released without the purchase of an operating system.
Microsoft to abandon standalone IE
I'm not sure how much support they would have for CSS3 anyway.
Then it would take a few years before significant numbers of users upgrade.
Mozilla , Opera and Netscape will keep developing and implementing the standards as best they can.
Heck I'm going to miss my bus.
Don't hold your breath, Im not even sure when CSS3 is due to be released, but I do know when my bus is coming
hmm...
I sorta just came here outta nowhere, but I saw this hread and thought it was so interesting I needed to reply:)
My suggestion is that you use php the count the words in the article (like mentioned earlier). Use the explode() function to split the article into single words and put it in a array. "count()" (pretty self-explaining) counts the values in the array. Then make some kind of if-loop to find out if you're halfway through the article, and then start a new column. Does this make any sense? Anyway... PM me if you need further help.
Newspaper columns?
Unofficially Netscape supports such
They should really make this part of CSS and implement is ASAP
http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/multicol.html
There are no great workarrounds TMK
If you really need control over layout, consider using Flash instead of HTML+CSS
... the lack of this multi column support is probably why a lot of sites use PDF for such documents
Newspaper columns?
Unofficially Netscape supports such
Does it still support it? I just checked out that link you posted in NS7 and it doesn't seem to be working.
Before you ask... yes, I did scroll to the bottom of the page!
Newspaper columns?
I'm new here but hopefully will be able to contribute some of what I've learned in the future.
The best three column "newspaper" layout I've seen is the International Herald Tribune site, which gives you the option to switch between one and three column layouts at the bottom. It works better in some browsers than in others (I know... goes without saying). I keep meaning to tear through their code and look at what's going on, I've just havn't found the time yet.
http://www.iht.com/articles/104585.html
(When you switch to three column layout you may have to reload the page to see the true layout)
[/url]
Newspaper columns?
That site is so kewl..... I like the navigation when you click on the columns itslef you can go next or previous page.
Newspaper columns?
I know this is an old thread, but it may be helpful for anyone else that Googles for the same thing I did:
php routine to split my text into 2 columns (sometimes I'm soo lazy and can't be bothered writing one myself).
Thanks to eirikra for the psuedo-code.
This will output an HTML table, 2 columns of 200pix wide:
I didn't want the text split exactly in half, because it doesn't look quite right in my application, but you can play with the "halfthewords" variable, of course.
function newspapercolumns($str) {
$textout = $str;
$thewords = explode(' ', $textout);
$numwords = count($thewords);
$halfthewords = $numwords*3/5;
$wordcounter = 0;
$textout = "<table cellspacing='0' cellpadding='0'><tr><td width='200' valign='top'>\n";
while ($wordcounter < $halfthewords) {
$textout .= $thewords[$wordcounter]." ";
$wordcounter++;
}
$textout .= "\n</td><td width='20'> </td><td width='200' valign='top'>\n";
while ($wordcounter <= $numwords) {
$textout .= $thewords[$wordcounter]." ";
$wordcounter++;
}
$textout .= "\n</td></tr></table>";
return $textout;
}