MyBB Community Forums

Full Version: Template question related to code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
if i remove a line from the template that is it's own query . . . for ex, $welcomeblock from the header template. . . will the query still be executed?

might sound dumb but reason i ask is cuz i'm figuring that the code is called when the template tries to show it. . . and if it's not being show, then it's not being called.

eh? or is that folly?
I believe that query is run in global.php before MyBB attempts to parse the template.
Well, what laie_techie said was almost correct. The queries are run in the php files, but not specific in global.php. Example: The templates for a thread are queried in showthread.php. The templates that are used in every page are queried in global.php. They work like this:
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_member")."\";");
This will replace $welcomeblock in the header template with the header_welcomblock_member template.

So if you remove $welcomeblock from the header template, the query will still run, but it just won't show it on the page. Because there is nothing to replace. If you really don't want to run the query, you should remove that piece of php-code.
yeah that's the piece of info i was after and what i feared. Reducing dbload for busy sites would be quite a task.

Thanks.