Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Mod Name / Version: Allow Visited Pages To Be Cached By Browser

Description: Some hosts use an HTTP header which prevents already visited forum pages from being cached by your browser.

Thus, when you use the back/forward browser buttons, you will need to reload every single page fresh again, which greatly slows down forum browsing for dial-up users when jumping in and out of threads, as well as increases bandwidth usage.

This mod will allow you to override their HTTP header with your own, which does permit caching.

All clicked on links will still always load fresh - that functionality won't be affected whatsoever. This way the *user* can decide if they wish to draw from their cache or reload from the server.

Many hosts already use the following configuration by default, but for those that don't (eRoute for example), here's the fix...



Working Under: UBB.Threads 6.2-6.3-6.4-6.5

Mod Status: Finished

Any pre-requisites: none

Author(s): Twisty

Date: 11/27/03

Credits: none

Files Altered: templates/default/ubbt_header.tmpl

New Files: none

Database Altered: no

Info/Instructions:


Change ubbt_header.tmpl

FROM THIS:


Code
<? //UBBTREMARK <br />echo <<<UBBTPRINT <br /><!-- START OF header.tmpl TEMPLATE --> <br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br /><html dir="{$ubbt_lang['READ_DIRECTION']}"> <br /><head> <br />$headerinsert <br />$refresh <br /><meta http-equiv="Content-Type" content="text/html; charset={$ubbt_lang['CHARSET']}" /> <br /><link rel="stylesheet" href="$stylesheet" type="text/css" /> <br /><link rel="shortcut icon" href="{$config['images']}/favicon.ico" /> <br />$javascript <br /><title>{$config['title']}: $inputTitle</title> <br /></head> <br /><body> <br /><!-- END OF header.tmpl TEMPLATE --> <br />UBBTPRINT <br />/* UBBTREMARK */ ?>



TO THIS:


Code
<? //UBBTREMARK <br />header("Pragma: private"); <br />header("Expires: 0"); <br />header("Cache-Control: private, post-check=0, pre-check=0"); <br />echo <<<UBBTPRINT <br /><!-- START OF header.tmpl TEMPLATE --> <br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br /><html dir="{$ubbt_lang['READ_DIRECTION']}"> <br /><head> <br />$headerinsert <br />$refresh <br /><meta http-equiv="Content-Type" content="text/html; charset={$ubbt_lang['CHARSET']}" /> <br /><link rel="stylesheet" href="$stylesheet" type="text/css" /> <br /><link rel="shortcut icon" href="{$config['images']}/favicon.ico" /> <br />$javascript <br /><title>{$config['title']}: $inputTitle</title> <br /></head> <br /><body> <br /><!-- END OF header.tmpl TEMPLATE --> <br />UBBTPRINT <br />/* UBBTREMARK */ ?>


:-)

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
This also works for 6.5.
Can someone modify the initial post?

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Thanks for verifying. Done.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Is there a way to find out if your host uses an HTTP header which prevents already visited forum pages from being cached?

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
[]DLWebmaestro said:
Is there a way to find out if your host uses an HTTP header which prevents already visited forum pages from being cached? [/]

Indeed there is. Upload this page to your ubbthreads folder (well it can go anywhere, but is most convenient there imo) and then open it in your browser.

Now notice the section where it says "Cache-Control" & "Pragma" and report back the configuration.

My server uses this (which *doesn't* cache PHP pages)...

------------------------------------------------------------
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache
------------------------------------------------------------

But regardless of what it's already set at, it won't do any harm at all to change the threads header to whatever you want as that will supercede the server header no matter what it currently is.

Sponsored Links
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
I already had an info.php file loaded.

The only listing mentioning cache is:
[]
session.cache_expire 180 180
session.cache_limiter nocache nocache
[/]

The word "pragma" does not exist.

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Well an easy way to tell is by simply looking in your browser cache to see if any forum pages are found there

With yours, it is already caching them so you have nothing to worry about.

Joined: Mar 2003
Posts: 215
Junior Member
Junior Member
Offline
Joined: Mar 2003
Posts: 215
I was just wondering, when using this, and returning to a forum that's been cached, doesn't this mess up marked read display until the user refreshes the page? As well as new posts that they've added not showing up until the thread is refreshes, etc

Last edited by RandyJG; 06/23/2004 9:13 PM.
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
[]RandyJG said:
I was just wondering, when using this, and returning to a forum that's been cached, doesn't this mess up marked read display until the user refreshes the page? As well as new posts that they've added not showing up until the thread is refreshes, etc [/]

I think I explained it pretty well in my initial post. All links (ie. forum navigation links) will still load pages fresh which is an important point, but the browser <- -> buttons will draw from the cache (which as you say won't be updated until refreshed). Thus the user decides which method they wish to use.

This way those on dialup can refresh occassionally as needed instead of constantly which is much slower.

Incidentally, the functionality with this enabled will be identical to the way the threadsdev forum functions right now, because it caches pages too.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)