Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Template system(s) are <em>not</em> the end-all-be-all solution to separation of presentation logic. They are <strong>a</strong> solution, and one used by many PHP frameworks. In general "MVC"/MVA/MVP/MVVM PHP development, you do not want any business logic in the presentation layer. Echoing out HTML is a (usually) direct violation of this practice; With templates, business logic is not present in the presentation layer, and vice versa.</p> <p>Skipping back to the first point, templates are <strong>a</strong> solution, not <strong>the</strong> solution. There are a ton of options available for the presentation layer, depending largely on your coding style and/or framework/library usage.</p> <p>On a personal level I prefer templates (for most small-med projects) for a few reasons beyond what's outlined above:</p> <ol> <li><p>Makes "theming" and swapping site styles a lot easier. Simply modify the template or implement a theme switcher that can load different templates</p></li> <li><p>Going from mockups to templates is a breeze, because templates are (usually) just HTML with some php snippets echoing out data.</p></li> <li><p>Templates are "dumb." They don't need to know about anything that's happening with the business logic, all they care about is echoing out some data into the HTML.</p></li> <li><p>Readability. This one is almost entirely personal preference, especially considering the wide range of template syntaxes out there.</p></li> </ol> <p>tl;dr - Templating vs. [insert other solution here] is almost entirely subjective, unless you have constraints based on hosting, customer requirements, traffic levels, etc. If that's the case, then find benchmarks and more about efficiency and scalability and make an informed decision based on the requirements of the project.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload