Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.