[NTLUG:Discuss] Need PHP/HTML help.

Joe Torma joe at domainworldaccess.com
Wed Jan 5 20:34:19 CST 2011


This may help.  I'd do the lifting in .htaccess if I were you...

http://blog.triphp.com/lessons/htaccess/cache-filetypes 

-----Original Message-----
From: discuss-bounces at ntlug.org [mailto:discuss-bounces at ntlug.org] On Behalf
Of Steve Baker
Sent: Wednesday, January 05, 2011 8:17 PM
To: NTLUG Discussion List
Subject: [NTLUG:Discuss] Need PHP/HTML help.

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


_______________________________________________
http://www.ntlug.org/mailman/listinfo/discuss




More information about the Discuss mailing list