943,660 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2222
  • PHP RSS
May 23rd, 2009
0

How to split text into pages?

Expand Post »
Hi ,

I have a text field in a table and i would like to split it into pages for viewing pleasure. I know how to split it into set of pages if it is in rows. But i couldn't get clue how to split a lengthy text field into pages which is present in a single column of a table.
Any ideas or guidance will be very helpful to me.

Thanks!
Similar Threads
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
May 23rd, 2009
1

Re: How to split text into pages?

well you could use a paginator
and count the number of words in the entire 'book' then each word i part of an array and you just output a certain number of array items per page.....specified in the paginator settings.
Reputation Points: 11
Solved Threads: 4
Junior Poster
sacarias40 is offline Offline
113 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

Click to Expand / Collapse  Quote originally posted by sacarias40 ...
well you could use a paginator
and count the number of words in the entire 'book' then each word i part of an array and you just output a certain number of array items per page.....specified in the paginator settings.
Thank you for the quick reply.
What actually is a paginator? Is it a set of code lines? i googled little after seeing your post about it.
Do you recommend any specific paginators?
OR
shall i make use of some string syntax to count total words in a text and split it into number of words resulting in a page? If i follwo this method, then it might result in awkward splitting where it might break a sentence even before it ends.
So.. if i use somthing like display till a full stop is encountered , then if a code is present then again its a problem.

Please suggest something. Thank you.
Last edited by csharplearner; May 23rd, 2009 at 11:19 pm.
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

you could go like this.....
PHP Syntax (Toggle Plain Text)
  1. $string = 'this is a small sample sentence that should be split up';
  2. $words = explode(' ', $string);
  3.  
  4. for($i = 0; $i = count($words); $i++){
  5. echo $words[$i] . '<br />';
  6. }

you could even split it up by sentences. by using the delimiter in the explode function as '.'
Last edited by sacarias40; May 23rd, 2009 at 11:34 pm. Reason: forgot something
Reputation Points: 11
Solved Threads: 4
Junior Poster
sacarias40 is offline Offline
113 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

Thanks! I shall work on this and post back
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

if you would like i can send you a paginator class that i made if that would help you.
Reputation Points: 11
Solved Threads: 4
Junior Poster
sacarias40 is offline Offline
113 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

Click to Expand / Collapse  Quote originally posted by sacarias40 ...
if you would like i can send you a paginator class that i made if that would help you.
Thanks a Ton sacarias40. I really appreciate it.
I would like to give it a try first with the hints you have given and later if unsuccessful i shall certainly ask your help again for the class file you made.
Reputation Points: 11
Solved Threads: 3
Junior Poster in Training
csharplearner is offline Offline
99 posts
since Nov 2008
May 23rd, 2009
0

Re: How to split text into pages?

alright that sounds fair. im here if you need me.
Reputation Points: 11
Solved Threads: 4
Junior Poster
sacarias40 is offline Offline
113 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: .php url problem
Next Thread in PHP Forum Timeline: if statement /mysql help please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC