Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Template

A template is a preset document, filled with values in placeholders, to display the resulting data. This is also called a view.

PHP used to be known as a template engine. Nowadays, template engines are written with PHP and set up a specific set of instruction.

Templates may be produced in any file format, such as HTML, CSS, JavaScript, JSON, PDF, URL, Markdown, etc.

Template may be large: they are then broken down into smaller and reusable sub-templates.

There are many PHP template packages, such as Twig, Latte, Blade, smarty, etc.

<?php

    // piece 
    echo "<h1>".$name."</h1>";

?>

Documentation

See Also