RE: [PHP] cache control with javascript
| From: | Joshua Minnie | Date: | Tue, 21 Oct 2003 16:16:29 +0000 |
| Subject: | RE: [PHP] cache control with javascript | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166974@lists.php.net to get a copy of this message | ||
That really helped, I didn't think about generating the file that way. I
have done other things like that, but sometimes it just helps when you get
another set of eyes on the project at hand. Thanks for the refresher.
Josh
-----Original Message-----
From: - Edwin - [mailto:copperwa11s@yahoo.co.jp]
Sent: Tuesday, October 21, 2003 11:56 AM
To: Joshua Minnie
Cc: php-general@lists.php.net
Subject: Re: [PHP] cache control with javascript
On 2003.10.21, at 22:28 Asia/Tokyo, Joshua Minnie wrote:
> The "it" that you were asking about was the server. The javascript
> file is
> actually a PHP file that produces the JavaScript that I need. I only
> have
> one access to a database and a while loop to generate the code. Here
> is the
> code pieces:
...[snipped_code]...
> The customer database can get potentially large so that this file
> could take
> a while to generate. Currently there are only 300 records but I
> anticipate
> many more. Does anyone have any recommendations that might speed this
> up?
Hmm... I think you missed the point earlier.
Here's the basic idea. Create/generate a separate file ("whatever.js")
[1] and make sure that this file is ONLY *updated* when necessary (e.g.
updated database)[2]. Call this file inside your HTML <head> tags. [3]
This way, the "whatever.js" will be "cached" whenever possible.
- E -
[1] Check the file functions in the manual (if you're not familiar with
it already).
(http://www.php.net/manual/en/ref.filesystem.php)
[2] Tip: Have a separate php script that generates the "whatever.js".
Use/run this script ONLY after you made an update to your database.
[3] Something like this:
<head>
<script src="/path/to/whatever.js" language="javascript"
type="text/javascript"></script>
</head>
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/