Playframework twirl (scala templates) guides

Viewed 2589

Good day all

note: Play! Framework newbie here.

I am trying to familairze myself using scala templates for a project, but cannot quite seem to get it right, nor do the examples found online always work correctly.

Problem:

I have to have searched for small solutions for a problem, and frequently encounter syntactical errors or the like.

I decided to search for some comprehensive guide to building Scala templates used as views, but found only fragments and pieces of code that may help.

Documentation Provided:

Play provided examples:

Variables:

Displaying Data:

Passing Data / Objects:

Further Reading:

Question:

note: I am asking this only since I have no idea how to proceed

Is there any comprehensive guide for building Scala templates. Documented to such a degree as one would find for Play! Framework?

TL;DR Where did you learn / discover how to create simple to complex Play! Scala templates?

2 Answers

I would say the templates are somehow intuitive. You write html and when you want to do some scala you should start the expression with an @.

When I find myself struggling with the syntax I just google "scala play twirl map" if I want to know the syntax for the .map (twirl is the real name of the template engine)

Besides that, the documentation under https://www.playframework.com/documentation/2.6.x/ScalaTemplates should be the best resource

Related