tbronson
04-06-2009, 03:11 PM
A real beginner question about presentation templates for various web apps:
Is there a significant performance difference between separating PHP and HTML code into lots of separate files, as opposed to concentrating them in a few files?
For example, templates by different authors for the same application can run the range, from a minimum number of separate files, to...many!
For example, one template may call a function in a separate file to check the user login state, and then call appropriate login code from two separate files (login or loggedin). Another template may include the logic (IF logged in) and the different code snippets all on the main page.
I realize there are many factors involved, like separating logic and presentation, code clarity, templating systems, and so forth.
I'm just wondering if there's a broad coding rule of thumb for when to separate out something into a new file, as opposed to keeping it all in one place.
I guess the broader question is, how do you monitor and test for coding efficiency, and does that even matter much in the real world, for things like web presentation templates?
Thanks!
Is there a significant performance difference between separating PHP and HTML code into lots of separate files, as opposed to concentrating them in a few files?
For example, templates by different authors for the same application can run the range, from a minimum number of separate files, to...many!
For example, one template may call a function in a separate file to check the user login state, and then call appropriate login code from two separate files (login or loggedin). Another template may include the logic (IF logged in) and the different code snippets all on the main page.
I realize there are many factors involved, like separating logic and presentation, code clarity, templating systems, and so forth.
I'm just wondering if there's a broad coding rule of thumb for when to separate out something into a new file, as opposed to keeping it all in one place.
I guess the broader question is, how do you monitor and test for coding efficiency, and does that even matter much in the real world, for things like web presentation templates?
Thanks!