Template Engine: An Overview of Smarty Templates & Other Comparisons
The template engine’s job is to help separate out application model logic from display logic and to provide a simpler, more readable way to add functionality to your display files. Since HTML was never meant to handle arbitrary logic, it is generally kept separate from the Model and Controller layers of an application – learn more about MVC.
However, it’s inevitable that at least some presentation logic gets mixed up into the HTML template file due to requirements such as “Alternate background color of each table row” or “Show only positive balances”. So, rather than mix standard PHP code into the HTML template file, template enginhowes were conceived which mask common PHP functions and tasks with more presentable and concise code and allow for a deeper separation of logic and markup.