Prev | Current Page 506 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The use of raw is left for advanced uses
only and using it explicitly prevents unwilling misuses.
Logical Expressions
The if/elseif/else expressions are exactly the same as described for haxe.Template . Templo
adds the cond expression that is used inside an (X)HTML and permits to toggle its visibility based on a
Boolean condition; the element will be visible just in case the condition evaluates to true.
The following template will display the link to an e - mail address if the e - mail value is passed in the data
object or the no email message otherwise.
< a ::cond (email != null & & email != ?????™):: href=???mailto:::email::??? >
::email::
< /a >
< span ::cond (email == null || email == ?????™):: > no email < /span >
Loop Expressions
The syntax for the foreach structure in Templo is slightly different from what you have already seen for
haxe.Template . In Templo it is necessary to label the current element with a name. That name will be
used inside the foreach context to access the object value and fields.


Pages:
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518