Jump to content


Photo

Paging!


  • Please log in to reply
9 replies to this topic

#1 lancey10

lancey10
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 23 February 2006 - 11:17 PM

how do i make it so a certain amount of text displayed on a page will create a new page to finish reading the text?

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 24 February 2006 - 12:16 AM

Well, you could use strlen to find the length of your text, then if it exceeds the length that you have determined to be one page, you could use substr to seperate out only that many characters to display, along with a "next page" link.

Of course doing that means that it wouldn't do clean transitions. In other words, if you decided that 10000 characters was one page, and the 10000th character was in the middle of a word, it would cut that word in two.

#3 lancey10

lancey10
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 24 February 2006 - 12:43 AM

[!--quoteo(post=348857:date=Feb 23 2006, 07:16 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Feb 23 2006, 07:16 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Well, you could use strlen to find the length of your text, then if it exceeds the length that you have determined to be one page, you could use substr to seperate out only that many characters to display, along with a "next page" link.

Of course doing that means that it wouldn't do clean transitions. In other words, if you decided that 10000 characters was one page, and the 10000th character was in the middle of a word, it would cut that word in two.
[/quote]
is there a script or a tutorial that i can see?

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 February 2006 - 12:48 AM

[a href=\"http://ca.php.net/manual/en/function.str-word-count.php\" target=\"_blank\"]http://ca.php.net/manual/en/function.str-word-count.php[/a] in the manual, and look at the notes provided by webmaster at joshstmarie dot com .. that's what you're asking about.
Legend has it that reading the manual never killed anyone.
My site

#5 lancey10

lancey10
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 24 February 2006 - 01:05 AM

thanks but how would it retrive the other half of the text from another page.... tutorial doesnt help with that

#6 lancey10

lancey10
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 24 February 2006 - 11:18 AM

anyone?

#7 litebearer

litebearer
  • Members
  • PipPipPip
  • Advanced Member
  • 2,357 posts
  • Locationwhite lake michigan

Posted 24 February 2006 - 01:48 PM

a rough sledgehammer approach would be to create some session variables that will track...

1. the original text
2. the page you are on

with those two pieces of information you could calculate which portion of text to display and loop through the original text.

Probably a clumsy way to do it but it sould work til you can refine it.

Lite...

all the brothers were valiant!

[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture

#8 lancey10

lancey10
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 27 February 2006 - 08:55 PM

ook so i tried and still no luck, is there a tutorial or can anyone tell me how to do it step by step? or example script?

#9 stevepatd

stevepatd
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 05 January 2007 - 04:28 AM

Wow, this is almost a year old.  Did you ever get it figured out??? 

I have a similar issue where I'm printing several tables.  Each table is in the neighborhood of 40 something lines.  So, when printed, the page breaks break the table into two.  Is there a command you can send to the printer?

Thx.

#10 chronister

chronister
  • Members
  • PipPipPip
  • Advanced Member
  • 1,438 posts

Posted 05 January 2007 - 08:20 AM

Page 1
<br style="page-break-before:always;">
Page 2
<br style="page-break-after:always;">
Page 3


This will force the printer to break the page at the requested points.  The above would give 3 pages.
"If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime."

If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it.
-- W.C. Fields




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users