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!

Recommended Answers

All 7 Replies

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.

commented: tnx! +1

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.

you could go like this.....

$string = 'this is a small sample sentence that should be split up';
$words = explode(' ', $string);

for($i = 0; $i = count($words); $i++){
echo $words[$i] . '<br />';
}

you could even split it up by sentences. by using the delimiter in the explode function as '.'

Thanks! I shall work on this and post back :)

if you would like i can send you a paginator class that i made if that would help you.

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.

alright that sounds fair. im here if you need me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.