I wonder if play 2.0.3 and higher supports else if
in views? I only read that one have to code that way: if {...}else{if{...}else{...}}
cannot believe that.
Razor minimizes the number of characters and keystrokes required when writing a view template, and enables a fast, fluid coding workflow.
Play Framework is an open-source web application framework which follows the model–view–controller (MVC) architectural pattern. It is written in Scala and usable from other programming languages that are compiled to JVM bytecode, e.g. Java.
A Play Scala template is a simple text file that contains small blocks of Scala code. Templates can generate any text-based format, such as HTML, XML or CSV. The template system has been designed to feel comfortable to those used to working with HTML, allowing front-end developers to easily work with the templates.
I used an @ before the second if :
@if (true) { ... } else { @if (true) { ... } else { ... }}
The @Todd Flanders answer is right. In a wrapper @{}, you can write your normal Scala code. Example
@{ if (profile.sex == 0) { <p class="col-md-6">Other</p> } else if (profile.sex == 1) { <p class="col-md-6">Male</p> } else { <p class="col-md-6">Female</p> } }
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