|
|
#1 (permalink) |
|
Uniquely Me
Super #1
Joined in Nov 2003
Lives in Anywhere
Hosted on Pass
2,660 posts
Gave thanks: 0
Thanked 0 times
|
keeping a page cached?
I need some help.
First, is it pronounced like cash or cashay? I hear it both ways and wasn't sure which was was correct, if either. second. I need some code from ya'll. I need something to keep a page cached for a while, about an hour would be nice. I'm making a site that will have a lot of static content (header, footer, navigation, various images, etc.) and the rest is phpinclude(). I would prefer to have a shell for an index page. I want just index.html to have very little in the source, makes things easier on me. I would use phpinclude() or header() or whatever else for everything. Any help here is much appreciated. If this is already a thread somewhere, feel free to yell at me, but I didn't see it. Thanks in advanced. - Dale?
__________________
Server: Pass Website: MrCoolDale.com Current Project: As Of Yet - Uniquely Me Co-Winner: 2004 Surpassies - Ultimate Surpasser
|
|
|
|
|
|
#2 (permalink) |
|
Web Hosting Super Ninj4
Super #1
Joined in Sep 2003
Lives in Fullerton, CA
1,581 posts
Gave thanks: 0
Thanked 2 times
|
http://dictionary.reference.com/search?q=cache&r=67
![]() I don't think you can force a browser to cache a page, but only force it to not read from cache. It should happen automatically by the browser, unless your site tells it not to, or the user has disabled it. I could be completely wrong, though. I spent a couple of minutes searching on Google, and found nothing on how to force a browser to cache a page. |
|
|
|
|
|
#4 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
I use php include for a lot of stuff. My index.php looks something like this:
PHP Code:
The page is designed with CSS and divs. If you use CSS, and much of your graphic content is part of that css (backgrounds to divs, etc) then you'll see a lot of that get cached so that it won't have to be reloaded. John
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|
|
|
#5 (permalink) |
|
Surpass Fan
Super #1
Joined in Dec 2003
Lives in NJ
5,057 posts
Gave thanks: 0
Thanked 4 times
|
Cache is a worthy foe.
Different browsers implement cache and provide for many possible configurations. For instance - IE5-6 allows for settings that will force the browser to fetch for a new instance of the page contents on every visit to a site. Or it can be set to never. These settings work, sort of - because they can be overriden if you output the right magic headers for the browser. As Gump says - "browser cache is like a box of chocolates. you never know what you gonna get. Jenn-ay! Come back to Greenboro!" |
|
|
|
|
|
#6 (permalink) |
|
Uniquely Me
Super #1
Joined in Nov 2003
Lives in Anywhere
Hosted on Pass
2,660 posts
Gave thanks: 0
Thanked 0 times
|
thanks everyone, I have another question for bigjohn.
John - how does that coding work? What kind of stuff would I need to change if I wanted to include a page called header.html? I'm still kind of new to php and don't really know what I'm looking at. - Dale?
__________________
Server: Pass Website: MrCoolDale.com Current Project: As Of Yet - Uniquely Me Co-Winner: 2004 Surpassies - Ultimate Surpasser
|
|
|
|
|
|
#7 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
you can 'include' any filename. You just have to make sure that you don't include a </body> before proper content...
Here is a head.inc: PHP Code:
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|
|
|
#8 (permalink) |
|
Uniquely Me
Super #1
Joined in Nov 2003
Lives in Anywhere
Hosted on Pass
2,660 posts
Gave thanks: 0
Thanked 0 times
|
to tell you the truth bigjohn, I haven't the slightest idea what I'm looking at there. What exactly does that script do?
- Dale?
__________________
Server: Pass Website: MrCoolDale.com Current Project: As Of Yet - Uniquely Me Co-Winner: 2004 Surpassies - Ultimate Surpasser
|
|
|
|
|
|
#9 (permalink) |
|
minor deity
Super #1
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
|
The scripts don't do anything.
If you look at the index.php you'll see 'require head.inc' that means that every instance of the page will load that. Because PHP is server parsed, the first bit of content that is returned to the client browser is the content in the head.inc file. Note that it's completely the same as if I did that part of the page in HTML alone, right? How I learned to do this is: 1 - think of the page that you'd want and how it would be built in HTML 2 - think of the logical ways to break it into pieces so that you can update the content. then hack the parts into '.inc' files. if content has to be dynamic inside, you can use variables too...
__________________
Proud to be a Surmunity Mod! XEON Make a fundamental difference! My Sites: Curious about Brewing Beer? Join the community! >>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax Get into an Art museum Victorian London It's your brain -ON WEB - mybrainhost.com (under development) What SHOULD Government do? Much Less than it Does! |
|
|
|