[NTLUG:Discuss] Need PHP/HTML help.
steve at sjbaker.org
steve at sjbaker.org
Thu Jan 6 15:51:35 CST 2011
> Since you are including myscript.php into index.php, the
> browser will only see one page - index.php.
> Remember, all php code is rendered out before the browser
> sees the page. All it knows is the HTML result.
Doh! Yes - that makes sense - I should have realized that.
> The gigantic JavaScripts will be cached, but will need to
> load each time a user first visits your page.
Each time he "first" visits the page - you mean each time he restarts his
browser and re-visits - or each time he revisits...period?
What I guess I need to know is whether the JavaScript files that are
pulled in with <script src="...."> are cached separately from the PHP/HTML
that the script tag lives in...and I guess the answer is "Yes" - which is
exactly what I was hoping for. But there seems to be no obvious way for a
".js" file to have a header telling us what cache strategy to use...so I'm
stuck with some kind of default behavior?
> I think
> you should check if you really need all that JavaScript.
> It will slow down the user experience. Also remember, the
> JavaScript has to be executed on the browser so it will
> take cycles on their machine. I find JavaScript laden
> pages make the browser quite sluggish.
Well, this is really a special case. I'm writing a 3D game using the new
WebGL 3D graphics stuff, check out a screen-shot:
http://www.sjbaker.org/tmp/1stPerson.png
This is native, inside the browser, no plugins or downloads of any kind!
I have 3D model meshes stored as enormous JavaScript arrays (they could be
JSON data - but then I don't believe they could possibly be cached) -
these are automatically generated from a "blender" 3D model file. The
code in those "scripts" are mostly L-O-N-G lists of densely packed numbers
in JavaScript arrays that are "executed" just once by the JavaScript
interpreter to initialise the arrays, then sent down to the graphics card
by WebGL and never looked at by JavaScript again...until the user reloads
the page.
At any rate, execution time of my ~11Mbytes(!) of JavaScript is not a
problem. The graphics of my game update at about 50 frames a second on
high-end PC's and about 10 frames a second on my oldest, nastiest Linux
box.
-- Steve
More information about the Discuss
mailing list