This is a discussion on RE: [PHP] splitting content into pages within the PHP General forums, part of the PHP Programming Forums category; daniel@electroteque.org <mailto:daniel@electroteque.org> on Wednesday, July 30, 2003 6:35 PM said: > hi ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
daniel@electroteque.org <mailto:daniel@electroteque.org>
on Wednesday, July 30, 2003 6:35 PM said: > hi there , i have an issue trying to split content into pages , we > have a popup with content and a background image with a set height , > when there is more content the background repeats , theoretically i'd > want to split the content into pages after a given length or line > length or where it meets the background image height how can i do > this ? This can be easy. 1. Make sure the content does not adjust itself based on the size of the browser window. That is to say that the space that contains the content should be a fixed width. 2. Then you need to calculate how many words you can legitimately fit into this fixed space without going over. If you 150 words will fit in the space but go right up to the very edge and are almost spilling into a new "page" you should pull the number of words back to 120 or something to try and make sure that the text will not spill over. You can be more precise if you use a fixed width font like Courier New. If you use a variable width font (not sure if that is the technical term) you'll have to do a little more guessing because 10 i's are not the same width as 10 w's. hth, chris. p.s. There is no space before a comma! |
|
|||
|
ok let me explain , its straight up text content from the database , say
its scrolls for ages , i need to split it into pages , so i get the length of the string up to the last paragraph which fits i need to split it there any idea ? > daniel@electroteque.org <mailto:daniel@electroteque.org> > on Wednesday, July 30, 2003 6:35 PM said: > >> hi there , i have an issue trying to split content into pages , we >> have a popup with content and a background image with a set height , >> when there is more content the background repeats , theoretically i'd >> want to split the content into pages after a given length or line >> length or where it meets the background image height how can i do this >> ? > > This can be easy. > > 1. Make sure the content does not adjust itself based on the size of > the browser window. That is to say that the space that contains the > content should be a fixed width. > > 2. Then you need to calculate how many words you can legitimately fit > into this fixed space without going over. > > If you 150 words will fit in the space but go right up to the very edge > and are almost spilling into a new "page" you should pull the number of > words back to 120 or something to try and make sure that the text will > not spill over. > > You can be more precise if you use a fixed width font like Courier New. > If you use a variable width font (not sure if that is the technical > term) you'll have to do a little more guessing because 10 i's are not > the same width as 10 w's. > > > hth, > chris. > > p.s. There is no space before a comma! |
|
|||
|
maybe somehow with a substr function that gets the position of the last
paragraph ?? > ok let me explain , its straight up text content from the database , > say its scrolls for ages , i need to split it into pages , so i get the > length of the string up to the last paragraph which fits i need to > split it there any idea ? > >> daniel@electroteque.org <mailto:daniel@electroteque.org> >> on Wednesday, July 30, 2003 6:35 PM said: >> >>> hi there , i have an issue trying to split content into pages , we >>> have a popup with content and a background image with a set height , >>> when there is more content the background repeats , theoretically i'd >>> want to split the content into pages after a given length or line >>> length or where it meets the background image height how can i do >>> this ? >> >> This can be easy. >> >> 1. Make sure the content does not adjust itself based on the size of >> the browser window. That is to say that the space that contains the >> content should be a fixed width. >> >> 2. Then you need to calculate how many words you can legitimately fit >> into this fixed space without going over. >> >> If you 150 words will fit in the space but go right up to the very >> edge and are almost spilling into a new "page" you should pull the >> number of words back to 120 or something to try and make sure that the >> text will not spill over. >> >> You can be more precise if you use a fixed width font like Courier >> New. If you use a variable width font (not sure if that is the >> technical term) you'll have to do a little more guessing because 10 >> i's are not the same width as 10 w's. >> >> >> hth, >> chris. >> >> p.s. There is no space before a comma! > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php |