Current location: Hot Scripts Forums » Programming Languages » PHP » splitting text into pages in php


splitting text into pages in php

Reply
  #1 (permalink)  
Old 01-04-05, 02:03 AM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
splitting text into pages in php

Hi All,

Does anyone know or have a script that splits the long text called from database into multiple pages ..... just like its done in the articles on many website for e.g. the splitting of article into pages done here http://www.sitepoint.com/article/css...-tips-tricks-4
.... I need the solution to this badly .... I was not able to find it over net. Anyone there to help.
Reply With Quote
  #2 (permalink)  
Old 01-04-05, 11:52 AM
JBChris JBChris is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Do a search for "pagination" on HotScripts or Google.
Reply With Quote
  #3 (permalink)  
Old 01-04-05, 05:43 PM
bionicsamir bionicsamir is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Hold on.... if I am not mistaken then you are talking about pagination ... which is taking the rows from database and displaying in seperate pages... e.g. 10 rows in first page and next 10 on second page etc...

but what I want to do is this

In my database there is a field with the name body which has article in it .... the article is about 2000 words.
I want the text in article (the text is in html format) to be chopped and displayed in seperate pages ... for e.g. 500 words per page ... therefore the article will come in 4 pages.
And obviously I dont want the pages to be seperated in the middle of the word ... for e.g. there is a word
'Development' and it should not be such that Deve is on one page and lopment goes to other page ...

The above is what I want to achieve .... any help...
Reply With Quote
  #4 (permalink)  
Old 01-04-05, 09:20 PM
JBChris JBChris is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
eeek... hmm... you can use substr to return a certain amount of characters. I'm sure there's some way to do words, I'm just not familiar with it. Try searching at php.net.

P.S. some pagination scripts work like you're requesting, they're just a bit harder to find...
Reply With Quote
  #5 (permalink)  
Old 01-05-05, 12:58 AM
Sabu Sabu is offline
Junior Code Guru
 
Join Date: Sep 2004
Posts: 458
Thanks: 0
Thanked 0 Times in 0 Posts
or you could manyually put somethign like <newpage> in the text itself where you want the next page to start, then play with explode() to get different pages showing different parts of the text.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Designing search engine friendly PHP pages snaip PHP 0 07-23-04 07:21 AM
Form -> text file -> php variables Bonzo PHP 1 06-16-04 07:37 AM
MySQL Query problem Wraith PHP 5 03-06-04 05:16 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM
How to convert php generated pages to SE friendly HTML or PHP(SE friendly) -CLASS 101 crippled PHP 1 11-16-03 06:37 AM


All times are GMT -5. The time now is 05:24 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.