Jump to content

Recommended Posts

I have set up a nice javascript pagination system using explode() with a pre-set seperator. This divides the root file by 'item' (an item comprises a title and sub-text)

For some pages the items are quite long and I would like the option to have a page split according to text length. The pagination script requires an array so I have been playing with:
$split_text=chunk_split($str,22,'|');
$split_array=explode('|',$split_text);

The only problem here is it ignores both words and html tags.
The only word-related php I can find is: str_word_count and this also ignores html tags.

I guess I could explode using a (full) stop but this snags if the page includes a path reference - eg. img src=../images/pot.gif
Ditto splitting by space.
In short, there seems too many if{} else{} permutations to try this approach.

So, how to split (or explode) a bunch of html in relation the actual text?
Any suggestions or solutions would be much appreciated.

cheers - arfa
Link to comment
https://forums.phpfreaks.com/topic/14257-split-html-for-pagination/
Share on other sites

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.