.. include:: ../Includes.txt Adding a template ================= In Extbase frontend templates are created in a subdirectory of :file:`EXT:store_inventory/Resources/Private/Templates` - if not configured otherwise. The name of the subdirectory results in the last part of the controller class name without the ``Controller`` suffix. So the class name ``\MyVendor\StoreInventory\Controller\StoreInventoryController`` results in the directory name *StoreInventory*. Below the directory :file:`StoreInventory` we create the file with the HTML template. The name of the file results of the name of the action that is called with the suffix *.html*. So the filename in our case is *List.html*. .. note:: You have to be aware that the filename is *List.html* and not *ListAction.html*. *list* is the name of the action. ``listAction()`` is the name of the corresponding method in the controller. The filename must be written in *UpperCamelCase*. Without additional configuration Extbase expects the suffix *.html*. It is also possible to use templates for other formats, such as JSON or XML. How these are called is described in chapter 8, section "Using different output formats". The HTML template in the file :file:`EXT:store_inventory/Resources/Private/Templates/StoreInventory/List.html` looks like the following: .. code-block:: html
Product name Product description Quantity
{product.name} {product.description} {product.quantity}
The inventory is rendered as a table. We can access the the array with the product objects that we assigned to the view in the controller via :php:`$this->view->assign('products', $products)` with ``{products}``. Tags starting with ``