Register Members List Search Today's Posts Mark Forums Read

Article Options
[tip] [phpinclude] Custom templates prased = extra query's
Join Date: Nov 2001
Posts: 4,765

by Brad Brad is offline 01 Aug 2003

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 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.
Views: 3158
Reply With Quote

Similar Article
Article Author Type Replies Last Post
Bring back the phpinclude templates Boothby vBulletin 3.5 Add-ons 7 03 Aug 2005 12:41

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Article Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

New To Site? Need Help?

All times are GMT. The time now is 18:39.

Layout Options | Width: Wide Color: