Now that we have a good understanding of how a template can help in creating views, we'll try to adapt our templates to make them interesting. The idea is to fix all the concepts seen so far in your mind.
In the first section, we created a listContainer
template that was able to render a sequence of strings into a ul
HTML element. In this section, we'll adapt it a bit to enable a header and a footer around the list. For that, we'll use currying and the internal HTML representation of Play! 2.
So, all we have to do is redefine the listContainer
function to take two new parameter blocks, header
and footer
, which are HTML excerpts.
As expected, the type of these new parameters is Html
, which is the internal representation of HTML blocks in Play! 2. Then, we use them right before and right after the block disPlay!ing the list, and we remove the previoush1
element (which was saying Here we go!).