Jump to content

Splitting large pages to smaller pages


Nofger

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/152004-splitting-large-pages-to-smaller-pages/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.