Log in

View Full Version : how does template caching work?


flat6
05-24-2004, 06:53 PM
I'm looking at the following:

// get special data templates from the datastore
$specialtemplates = array(
'smiliecache',
'bbcodecache',
'banemail',
);

// pre-cache templates used by all actions
$globaltemplates = array(
'USERCP_SHELL',
'usercp_nav_folderbit'
);


It seems that beyond declaring the names of the array, nothing else happens. What am I stupidly overlooking :ermm:

Zachery
05-24-2004, 07:01 PM
It puts these files into the datacache which means they can be called with out needing to run a query to do it

flat6
05-24-2004, 07:06 PM
So, I've got a new template, called modifywidget. How would I go about getting this new template cached? I'm guessing there's more to it than just $widgettemplates = array('modifywidget');, but I'm not sure where the rest of the behind-the-scenes templace caching action takes place.

Zachery
05-24-2004, 07:09 PM
$globaltemplates = array('modifywidget');

flat6
05-24-2004, 07:12 PM
But where does it do its caching thing? I want to see its guts :) Logically, there should be a DB query someplace, or at least some functions behind this.

Zachery
05-24-2004, 07:26 PM
Look in init.php ;)

flat6
05-24-2004, 07:44 PM
Excellent. One last thing, what's the rule of thumb for using $globaltemplates vs. $actiontemplates? The comments say "pre-cache templates used by all actions" vs "pre-cache templates used by specific actions". I'm basically going to be calling this from a function, so I'm leaning towards $actiontemplates, but not sure about the usage guides :nervous: <- hah, that smiley's great.

Edit: wait, is it that the subarray must be named by the name of the function, and will only be accessible from that function, while global can be used anywhere in the file?

Zachery
05-24-2004, 07:47 PM
special templates is ONLY for calling things that have been stored in the datastore table as far as im aware. if your just using templates you have made in vBulletin's tempalte system you use globaltemplates

flat6
05-24-2004, 07:50 PM
There's three things as far as I can see, $globaltemplates, $actiontemplates and $specialtemplates. I'm staying away from that last one, but from looking over vB3 code, it seems they're very stingy with the $globaltemplates and prefer to use $actiontemplates.

Zachery
05-24-2004, 08:08 PM
globaltemplates are for templates that are NOT used in actions, action templates are templates that are used in actions within the file, take at https://vborg.vbsupport.ru/showthread.php?t=59939

Banana
05-29-2004, 11:34 PM
ummm, can I force a reload from the database. The reason I'm asking is one hack (Who Was Online) "replace into"s a row in the database. I have some old stats that I'd like to update the database with and have the hack READ that.....

This is the relevant hack: https://vborg.vbsupport.ru/showthread.php?t=59579