Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Client-side caching

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
nasht
Smarty n00b


Joined: 25 Feb 2008
Posts: 4

PostPosted: Mon Feb 25, 2008 11:59 pm    Post subject: Client-side caching Reply with quote

Hi,
I'm looking for some tips on improve client-side caching.
I quickly looked at the Smarty.class.php file and saw a few header() commands like 'Last Modified', "Not Modified' , etc...
I'm not really sure if those are really being used.
I might be wrong but:
- I don't see any Last Modified or Not-Modified headers in my website according to firebug.
- Since only parts of my pages uses smarty, I don't see how Smarty could set any http headers since I already print HTML code before calling Smarty (eventhough I'm actually using an output buffer).

I want to improve client-side caching on my website.
I use Smarty for certain areas of my website, and use smarty caching (I use no expiration caching, and manually clear the cache when an article is modified).
You might like to know that the rest of the page is pretty much static HTML, it never changes.

I was thinking I could manually set header(Last Modified: whatever).
For this, I would need to know when was the smarty template cached last.
I know there is a is_cached() function, but is there a function that would tell me WHEN was this template cached?
If I knew that, since I use output buffer, I could send header("Last-Modified: $cache-time").

Other ideas?

Thanks!
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Feb 26, 2008 1:45 am    Post subject: Reply with quote

You must have caching enabled and set cache_modified_ceck true.

Code:
$smarty->cache_modified_check = true;
Back to top
View user's profile Send private message
Mds
Smarty Rookie


Joined: 12 Jun 2008
Posts: 17
Location: Sari

PostPosted: Thu Jun 12, 2008 12:47 pm    Post subject: Reply with quote

Thanks U.Tews
Back to top
View user's profile Send private message Yahoo Messenger
mychastic
Smarty Rookie


Joined: 12 Aug 2008
Posts: 21

PostPosted: Tue Aug 12, 2008 2:35 pm    Post subject: Reply with quote

Nice one. Thanks!
Back to top
View user's profile Send private message
slyydrr
Smarty n00b


Joined: 10 Nov 2008
Posts: 4

PostPosted: Mon Nov 10, 2008 4:57 pm    Post subject: Reply with quote

Awesome, this solved my issue too!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP