Prev | Current Page 510 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

In the following example, the template portion between the fill
expression and the end expression is executed and stored in a variable named fragment. This fragment
variable can then be reused many times. Remember that if the captured portion contains (X)HTML
elements or entities, you will probably want to use the raw expression to display the content unchanged.
::fill fragment::
< div > a content to repeat: ::content:: < /div >
::end::
< !-- more code goes here -- >
::raw fragment::
Template fragments can be shared in Templo using the use expression. With this expression, it is
possible to include a template inside another. So, you have a template file login.mtt that contains just a
fragment of (X)HTML relative to a login form; this can be used inside another template in this way:
< div id=???context-bar??? >
::use ???login.mtt??™::::end::
< /div >
Because the template name is an expression, in the previous example a constant string value, it is possible
to dynamically change which template to include based on the data passed to the execute() method.


Pages:
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522