Log in

View Full Version : How do I...


gwhooooey
04-27-2003, 05:49 PM
Do this?

Quick tip to drastically reduce queries:

Move all your template names into the

$templatesused = " "

section at the top of index.php.

In your index.php, search for the keyword "template" - any template being eval() that is not in the $templatesused section is an extra query on the database. Just copy the name and add it to the list in $templatesused and watch those queries drop.

Can someone explain that in more detail please.

And is there any other things like this I could do to reduce queries..

Btw, if this is in the wrong forum, I apologise, and if you move it, please let me know. Thanks

filburt1
04-27-2003, 05:52 PM
Defining $templatesused before requiring global.php will cache those templates. For example:

$templatesused = "mytemplate,anothertemplate";
require("./global.php");

...will cache those two templates. If you don't do that and then later in the file try to eval either template, it will create an extra query.

IMO I think it's a pretty dumb system; a better way (again, IMO) would be to associate each template with one or more PHP files, and then have the template engine automatically cache all necessary templates for that file.

Logician
04-28-2003, 10:24 AM
Yesterday at 09:52 PM filburt1 said this in Post #2 (https://vborg.vbsupport.ru/showthread.php?postid=388020#post388020)
IMO I think it's a pretty dumb system; a better way (again, IMO) would be to associate each template with one or more PHP files, and then have the template engine automatically cache all necessary templates for that file.
In default vb caching system dev has freedom to decide whether he will cache a template or not.

It is not always desired to cache all templates a .php file uses because some of them are used only in certain conditions (like error templates or ignore user templates) and devs may not want to cache these everytime that php file runs. This is because everytime you cache a template you are eating up your server RAM. Sometimes you prefer to save some RAM space, instead of saving an extra query which will be very infrequently added.

gwhooooey
04-29-2003, 03:15 AM
Thanks, I understand now

Xenon
04-29-2003, 04:06 PM
as i should mention, vb3 will use a completly different system for templatecaching, much better in my eyes if it's like i think now ;)