Computer Science Canada

Certain # of characters on page, than makes new page

Author:  poly [ Thu Aug 07, 2003 11:16 pm ]
Post subject:  Certain # of characters on page, than makes new page

How would you do something like say you only want 1000 characters on a page and anything more than that than a script would break it up into 2 pages, sort of like example here, lets just say there is a limit to 1000 characters to page in the example:

User inputs article using form...
script scans the article and determines how many characters
if there are less than 1000 characters than its one page, but if it is more than 1000 characters than it would break it up into 2 or maybe 3 pages etc. But say if the "r" in the word "word" is the 1000 character, than the script would make it so that "word" appears on next page

Author:  Amailer [ Fri Aug 08, 2003 1:44 am ]
Post subject: 

Do you want this to be done with or with out MYSQL?

what i mean is, is the articals information be from a database?

Author:  Homer_simpson [ Fri Aug 08, 2003 4:29 am ]
Post subject: 

int strlen ( string str) returns size of a string

Author:  poly [ Fri Aug 08, 2003 11:13 am ]
Post subject: 

well with MySQL.... (string str) ok i get that, but how do u make sure about a whole word not getting cut off

Author:  Amailer [ Fri Aug 08, 2003 1:07 pm ]
Post subject: 

I know,

How about we count the number of spaces?
Much simpler?

code:

function wrdcnt($haystack) {
echo substr_count($haystack,' ') + 2;
}


$haystack = "This is just a lil test OK!?!";

wrdcnt($haystack);


got that off:
http://ca3.php.net/manual/en/function.str-word-count.php


: