Helpful Information
 
 
Category: Programming Articles
[tip] [phpinclude] Custom templates prased = extra query's

One of the most common things people forget when using phpinclude, is all templates called via the template are not chaced. (in vB 3 it's broken into two templates, phpinclude_start, and phpinclude_end. This text apply's to vB 3, as of beta 4)

vBulletin is not smart enough to cache templates on demand, instead a list of templates is generated when a page is called. This list is passed into a query that pull's every template needed at the same time. However templates that are not included in this list will force vBulletin to run a extra query to grab the template when it is called.

There is not way of chacing templates via the phpinclude template. Templates are cached before phpinclude is rendered/executed.

There are two things you can do to avoid these extra quries from poping up. The frist is going over to vBulletin.org and finding out how to chace templates via the files. This is easy to do but can not be disscussed here per board rules.

The second is not using templates at all, but hard-coding the html that is needed into phpinclude. Remember the rules of php apply here, and replacements can be used.

Last but not least, do not ever call a template inside a loop in phpinclude, unless you chache it via the files.










privacy (GDPR)