swamp Posted August 28, 2008 Share Posted August 28, 2008 Hi there, I've got this code that spilts content into blocks of 900 characters: <? //split content into divs $i=0; for($t=0; $t<strlen($post);$t++){ if($t%902==0) $i++; $out[$i].=$post{$t}; } ?> <? foreach($out as $k=>$v) { //echo '<div id="content_'.$k.'">'.$v ?> <div id="content_<? echo $k ?>"> <p> <? echo nl2br($v) ?> </p> <p> <? if ( $k == 1 ) { echo " "; } else { //echo $k -1; ?> <span class="arrow-back"><a href="#" onClick="setVisible('content_<? echo $k -1; ?>');">previous page</a></span> <? } ?> <? if ( $k == count($out) ) { echo " "; } else { //echo $k -1; ?> <span class="arrow"><a href="#" onClick="setVisible('content_<? echo $k +1; ?>');">next page</a></span> <? } ?> </p> </div> <? } ?> It all works fine, but how can I make it so it will only put text in a new div after the end of a paragraph (the paragraphs are seperated with <br /> ? Thanks for any advice on this. Quote Link to comment Share on other sites More sharing options...
swamp Posted August 28, 2008 Author Share Posted August 28, 2008 Anyone? Quote Link to comment Share on other sites More sharing options...
Orionsbelter Posted August 28, 2008 Share Posted August 28, 2008 maybe if you comment next to coding with //// then we could understand abit more. Very confusing Quote Link to comment 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.