[NTLUG:Discuss] Need PHP/HTML help.
Neil Aggarwal
neil at JAMMConsulting.com
Wed Jan 5 22:36:53 CST 2011
Steve:
I always use these response headers when I want to ensure
a page is not cached:
Cache-Control: no-cache
Expires: 0
Pragma: no-cache
Obviously, you will need to put those at the top of
your index.php so they go out before the page begins
rendering any output.
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.
The gigantic JavaScripts will be cached, but will need to
load each time a user first visits your page. 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.
I hope this helps.
Neil
--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 5.5 preinstalled
Unmetered bandwidth = no overage charges
-----Original Message-----
I have a web page which is generated in PHP - and I'm concerned about
caching behavior.
The thing I'm concerned about is how all of this gets cached on the
client-side.
* "index.php" doesn't ever change...it always produces the same output
it would be nice if it were cached - but it's not essential.
* "myscript.php" doesn't change - but it IS going to produce different
output every time they visit the page. That's what I need...hence the
"no-cache" thing.
* all of the "giganticScript_N.js" files never change...and they are
truly gigantic (multiple megabytes each!) so I desperately want them to
More information about the Discuss
mailing list