Nofger Posted April 1, 2009 Share Posted April 1, 2009 Hello, Nice place i like this forum best one i found so far, anyway i got a website with very long pages and i want to split them into smaller pages thus increasing the amount of pages on the site. lets say the max amount of characters on a page is 5000 i need to split it there but if it's in the middle of a sentence or a paragraph i need to go the the beginning or the end of that paragraph. i tried different solutions but i can't seem to find an easy way to do this, the best way so far is manually and that sucks.. Any help would be great Quote Link to comment https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/ Share on other sites More sharing options...
chmpdog Posted April 1, 2009 Share Posted April 1, 2009 I use this, but Im not sure how you would make different pages: if (strlen($row['description']) > 60) { $description = substr($row['description'], 0, 60)."..."; } else { $description = $row['description']; } Quote Link to comment https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/#findComment-798286 Share on other sites More sharing options...
Nofger Posted April 1, 2009 Author Share Posted April 1, 2009 It doesn't split it in the end of the sentence\paragraph but after N amount of chars but thanks. Quote Link to comment https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/#findComment-798630 Share on other sites More sharing options...
premiso Posted April 1, 2009 Share Posted April 1, 2009 If paragraphs and the paragraphs are distinguishable you should look into using explode and explode the data at "\n" character: <?php $paragraphs = "split this at paragraph \n this would be the second paragraph"; list($firstPara) = explode("\n", $paragraphs); echo $firstPara; ?> At the substr man page there are a bunch of user contributions. Take a look there. Try this one first if what I posted does not solve your issue. Quote Link to comment https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/#findComment-798637 Share on other sites More sharing options...
Nofger Posted April 1, 2009 Author Share Posted April 1, 2009 Thanks, i've found what i was looking for. Quote Link to comment https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/#findComment-799010 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.