Reputation: 770
If I have a template like this:
<div class="lift:ThisIsMySnippet?option1=a_value;option2=another_value">
<div class="morestuff">
{embed}
</div>
</div>
and then a snippet like this:
class ThisIsMySnippet {
// I want option1's value!
}
How do I get those values?
Upvotes: 0
Views: 38
Reputation: 35443
I believe you can get the param values of a snippet via the S
object like this:
val x = S.attr("option1")
In this case, x
will be a Box[String]
, so if you want to get the value in a safe way you could do this:
val x = S.attr("option1") openOr "defaultValue"
Upvotes: 4