Jump to content

Template behaviours


Gazley
 Share

Recommended Posts

Hi,

Can anyone confirm whether templates are routinely loaded "up-front"? I'm playing around with the basic website provided with the standard PW installation.

I've replaced the home page with my own that doesn't reference the "basic-page" template. Even though my home page loads first, I'm seeing "basic-page" being instantiated in the background on numerous occasions.

If I alter its name to "_basic-page", the behaviour stops.

This isn't a problem or anything like that - I'm just keen to understand what PW is doing.

Thanks

--Gary

Link to comment
Share on other sites

Gazley, are you talking about template or template file? Honestly I'm not sure I fully understand your question. PW should load the template you specified in page's settings that in its turn have to have a template file with the same_name_as_your_template.php in /templates folder.

Link to comment
Share on other sites

PW keeps the meta data for all the templates and fields in memory. So I would expect to see basic-page somewhere in there whether it's used or not. This is basically just caching. Templates and fields aren't assumed to be infinitely scalable in quantity like pages are, so we take advantage of the performance benefits of having those things ready-to-go in one query. However, you shouldn't see any "template files" loaded that aren't being used in the request.

Link to comment
Share on other sites

@slkwrm - I'm referring to the template file in the templates folder

@soma - nice debugger crack; I know I'm going to regret starting the whole debugger thing ;)

@ryan - Caching would appear to be the logical reason so thanks for the confirmation that this indeed does happen.

Cheers!

--Gary

Link to comment
Share on other sites

@slkwrm - I'm referring to the template file in the templates folder

...

@ryanCaching would appear to be the logical reason so thanks for the confirmation that this indeed does happen.

Just wanted to clarify that it keeps the template names and meta data in memory, not the template files themselves. If you are seeing the basic-page.php file open in your debugger, and a page using that template is not being rendered, that doesn't sound right, so let me know. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...