A template, or model, is a pre-established file or structure that serves as a starting point for dynamically generating content or web pages. It typically combines an HTML structure to define the layout, CSS formatting to style the content, and specific placeholders or tags that will be replaced with actual data at runtime, often using a programming language such as PHP, JavaScript, Python, Ruby, and others.

Templates are widely used in Content Management Systems (CMS) or web frameworks to separate business logic (data processing) from presentation (display). They thus facilitate the creation of customized web pages by dynamically integrating data from databases or other sources.

A template’s operation is based on a coded file that defines the overall structure of a web page or a set of pages within a website in a consistent manner. This base file contains static layout elements that are already arranged and formatted, as well as variables or function results, and dynamic elements interpolated as strings. These templates are grouped into a theme, the set of files that make up the presentation structure of a website. The display of these page templates can vary depending on the query string that defines the template or set of templates to use to display the page.

A template can be broken down into several sub-templates, called layouts, which are specific models that determine the arrangement of elements, sections, blocks, or compositions. Common synonyms for template include stencil, document model, general document structure, skeleton, or blank page. It is also worth exploring related terms such as theme and layout.

Here are some examples of template engines based on DOM manipulation: Blade (Laravel), EJS, Liquid (Shopify), Jade, Pixelarity, Pug, Smarty