O'Reilly logo

Learning Play! Framework 2 by Andy Petrella

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing around

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.

Laying out

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required