PDA

View Full Version : when do i need to cache templates?


Dr.CustUmz
03-09-2016, 11:05 PM
im editing my new release
https://vborg.vbsupport.ru/showthread.php?t=322031

and in it i cache a temple, then in the next plugin i eval that template so i can shortcode it into another template, like so:
<plugin active="1">
<title>cache templates</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[

$globaltemplates = array_merge($globaltemplates, array('drc_lf_css'));

]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>global templates</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[

eval('$drcextcss = "' . fetch_template('drc_lf_css') . '";');

]]></phpcode>
</plugin>

in the mist of adding a new template to global cache i accidentally removed the original cache, which had no effect on my product.

so im just wondering. when is there the need to cache a template? I always thought they needed to be cached

squidsk
03-10-2016, 02:39 AM
If you don't cache the templates, each non cached template is another db query

Dr.CustUmz
03-10-2016, 04:37 AM
If you don't cache the templates, each non cached template is another db query

so like i thought, always cache the template

squidsk
03-10-2016, 02:12 PM
Yes, always. If you have your dev site in debug mode you'll see any templates that aren't cached labelled in red.