PDA

View Full Version : Template Caching Question


vbplusme
03-01-2009, 08:30 AM
Hello,

I have three templates that I created, two of them are javascripts and one is a simple text display. None of them do database queries but they all get reported as being uncached by the Microstats hack that I just installed.

The question is this, is template caching related only to queries? Would caching the javascript be something that I need to take a look at and how would it work. I know that some of the php scripts I have installed have explicit caching script but they bare no resemblance to the original template that is being called?

Any insight would really be appreciated.

TIA

Dismounted
03-02-2009, 05:11 AM
Templates are fetched en-masse at the start of execution. This is referred to as the "template cache". You need to add your templates to the $globaltemplates array to get your templates as well. Templates that are not cached will be fetched on request, using a query for every template.

vbplusme
03-02-2009, 09:29 AM
Thank you, I guess I thought that they were loaded automagically, LOL

Where to find the $globaltemplates array to add them?

Dismounted
03-02-2009, 09:40 AM
They are loaded automagically - it just costs queries. :p

Where are you using these templates?

vbplusme
03-02-2009, 10:32 AM
One of the javascripts is seen only by visitors, the world clock (also a javascript) is under the navbar on every page and the text template is in the side bar on every page.

Dismounted
03-03-2009, 04:52 AM
Can't you just add them to the templates themselves?