3 ms·
It could be considered bad practice in some cases. But having the template also act as a controller gives theme developers more freedom to make something outsid
by bryancinman 14y ago
It could be considered bad practice in some cases. But having the template also act as a controller gives theme developers more freedom to make something outside the golden path.
I doubt Wordpress would be used for anything other than simple blogs if it weren't for querying from templates.
Obviously there is the risk of theme developers loading tons of queries from a template but I think trying to prevent that would be premature optimization. The benefit of greater customizability outweighs the potential performance hit IMO.
- ericingram 14y agoYou said it better than I could have. Forcing template developers to maintain separate controller code prevents a lot of good work from getting done in my experience. If the project expands and the combined templates become a problem (usually due to the make up of skills in the team, i.e. heavy on back-end developers), separating them is pretty straight forward.