Request for Question Clarification by
bookface-ga
on
27 Oct 2003 10:13 PST
PHP won't help you to do the odometer-style changing, as it is all
server-side; to the web browser it appears to be a simple static HTML
page.
I would _highly_ recommend using JavaScript, and setting things up so
that you print out a number via a server-side process (like PHP, Perl,
ASP, JSP, etc.), and then use JavaScript (if it is enabled) will do
the work of updating the number as the user stays on the page. This
way the user at least gets to see a number and can refresh to get the
updated statistic, and if they have JavaScript they get to see the
numbers change on the fly.
You don't need to know what version of Java, for most cases; you will
not run into problems with something that simple. Besides, most people
with Java installed have a fairly recent version.
Flash is also a good solution because it is fairly popular, but a) it
is not as popular as JavaScript, and b) because you can't do the trick
mentioned above with server-side base numbers, it is better to stick
with JavaScript.
I think DHTML might be better suited to this design, but its relative
popularity is extremely low and so it is thus disqualified.
Another option that would be a little bit of a hack would be to use a
server script to output just the number with proper HTML tags and a
META-CONTENT refresh tag, and include it as an IFRAME in the page. I
understand this might be slightly confusing so I will reiterate: In
the main page you include an IFRAME whenever you have a counter
(IFRAMES place the contents of another page in a small frame in the
middle of the page, inline with your text.) As the source for the
IFRAME content, you choose a page with a little customized
PHP/Perl/JSP/etc. script to display the number for the moment the
script is accessed, wrapped in HTML tags that should cause a refresh
of the IFRAME content. (So it will be updated when the IFRAME
refreshes, but then another refresh request will be set in motion,
etc.) The problem with this is that it uses an internet connection
rather than a formulaic solution to pass each statistic, and thus is
rather blunt and consuming of resources. Also, you may not be able to
expect every browser to properly handle IFRAME refreshing.
So again, my solution to this problem is to display the statistic at
the time the web page is accessed with a server-side process, and use
JavaScript to update it if possible based on whatever formulas you
wish to use. You can even include in <noscript> tags a comment to
those users without JavaScript installed or enabled that they can turn
it on or refresh the page for updated statistics.
Please let me know if this is a sufficient answer, as it does not
address every point you asked for, but I feel it still indicates what
you were looking for.
- bookface