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. Link to comment https://forums.phpfreaks.com/topic/121681-solved-split-after-paragraph/ Share on other sites More sharing options...
swamp Posted August 28, 2008 Author Share Posted August 28, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/121681-solved-split-after-paragraph/#findComment-627776 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 Link to comment https://forums.phpfreaks.com/topic/121681-solved-split-after-paragraph/#findComment-627777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.