Template provides a way to create templates using HTML fragments. It contains the HTML elements and various placeholders that are replaced with the values of the fields present in the data that is given to the template API to use in conjunction with the template text. For example, we may have a
<div> element present in the body; based on the data, we may add the
<li> elements to it at runtime.
In this recipe we will look at typical usage of templates and understand what it takes to define and use one.
Make sure that you have set up your development environment by following the recipes outlined in Chapter 1, Gear Up for the Journey.
Create a new folder named
ch04 in the same folder in which ...