[NTLUG:Discuss] Need PHP/HTML help.
Steve Baker
steve at sjbaker.org
Wed Jan 5 20:17:07 CST 2011
Sorry - I have a web/PHP question which is a bit OffTopic...but I'm
desperate...and I know that there are a lot of web guru's here.
I have a web page which is generated in PHP - and I'm concerned about
caching behavior.
The file "index.php" has a tiny bit of PHP code that does essentially
just this:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<?php
include_once "myscript.php" ;
?>
</head>
<body>
...stuff...
</body>
</html>
...and "myscript.php" contains:
<meta http-equiv="pragma" content="no-cache" />
<?php
...calculate some stuff...
echo the_stuff ;
?>
<script type="text/javascript" src="giganticScript_1.js" ></script>
<script type="text/javascript" src="giganticScript_2.js" ></script>
<script type="text/javascript" src="giganticScript_3.js" ></script>
<script type="text/javascript" src="giganticScript_4.js" ></script>
....
<script type="text/javascript" src="giganticScript_50.js" ></script>
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
be cached and not reloaded just because myscript changed.
If I use <meta http-equiv="pragma" content="no-cache" /> inside
"myscript.php" - will it even be recognised if "index.php" is cached?
Alternatively, if it works as I hope and reloads myscript even if
index.php is cached - will it still cache my giganticScripts?
I can't find anyplace where the behavior is clearly described.
-- Steve
More information about the Discuss
mailing list