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:
Declaring variables
Declaring Variable 2
Displaying Data:
Displaying data using functions
Display Items in alternating rows table with indicies
Using blocks
Displaying Block Scala variables in html see the use of { and }
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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With