Jane04k Posted May 14, 2007 Share Posted May 14, 2007 I have a database entry that's super long (an entire first chapter of a book) and I want to display it on the top left side of a div until it reaches the bottom and then, after it reaches the bottom of the div, have it automatically flow into another separate div. This would occur on paginated pages so I'd need it to continue flowing to the next page then do the same auto flow thing again. Picture a book that reads from left to right and that's basically what I'm trying to do. Is this possible with php? Is this possible period? Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/ Share on other sites More sharing options...
chigley Posted May 14, 2007 Share Posted May 14, 2007 Depends at what point you want to split it really. Do you want half in one, half in the other? Or x chars in the first, and the remainder in the other? Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/#findComment-252943 Share on other sites More sharing options...
Jane04k Posted May 14, 2007 Author Share Posted May 14, 2007 x chars or words would work just fine. My main problem is that I can't figure out how to have it automatically flow to the next cell. Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/#findComment-252945 Share on other sites More sharing options...
chigley Posted May 14, 2007 Share Posted May 14, 2007 <?php $wordsinfirst = "2"; $string = "one two three four"; $words = explode(" ", $string); foreach($words as $word) { if($count < $wordsinfirst) { $string1 .= "$word "; } else { $string2 .= "$word "; } $count++; } echo "<div id=\"first\">$string1</div><div id=\"second\">$string2</div>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/#findComment-252956 Share on other sites More sharing options...
Jane04k Posted May 14, 2007 Author Share Posted May 14, 2007 awesome - works great! thanks for the help. :-) Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/#findComment-252963 Share on other sites More sharing options...
chigley Posted May 14, 2007 Share Posted May 14, 2007 You're welcome! Remember to click solved Quote Link to comment https://forums.phpfreaks.com/topic/51367-displaying-a-single-entry-in-two-separate-places/#findComment-252965 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.