At 4:30 AM -0700 5/4/06, Paul Novitski wrote:
At 11:51 AM 5/3/2006, Phillip S. Baker wrote:
I have some articles stored in a MySQL DB.
What I want is if the article is above a certain length in
characters, to page article through a few pages for site
readability.
So I would want to print X number of words/characters.
Save the where the pointer is, move on to the next page, and
display the same amount and so on for as many pages as needed.
Phillip,
There's a fundamental problem with trying to slice text into
resizable web pages the same way it's sliced on paper. Paper pages
work because they're set in a fixed font size. When you change the
ratio of font size to column width, the places where lines of text
wrap changes. Because of the varying lengths of words, strings of
words spill over to the next line in non-linear rates. Unless you
use a fixed font size (boo, hiss) or you change the font size and
the column width at exactly the same rate by sizing your layout in
ems, your text columns are going to change in height (line-count)
with font resizing.
-snip- (good stuff)
You could make the problem much more solvable by dishing up whole
paragraphs only, and learning to accept (nay, embrace!) the
resultant variation in page-length.
Paul
Paul et al:
If the text is organized into paragraphs, which I can't imagine it
not being, then the solution can be found in using a combination of
javascript and php.
Javascript can detect the size (height & width) of window the user is
currently using and the web site has control over the font size and
margins. With that information, via ajax, it's certainly solvable to
calculate what text would fit into the space provided and display it
in real time.
Granted it would make for a boring presentation because no titles or
variations in font sizes, but if someone wanted to simply throw text
to an open window, one could calculate how many paragraphs would fit
in the available space and the users actions (on-load, window-resize)
could trigger the operation.
Furthermore, if headings where identifiable, then those could be
thrown into the mix and calculated as well.
tedd
--
--------------------------------------------------------------------------------
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php