title:: < /title >
< meta http-equiv=???Content-Type??? content=???text/html; charset=iso-8859-1??? / >
< /head >
< body >
::raw __content__::
< /body >
< /html >
Now the main template is saved in a file main.mtt .
::use ???layout.mtt??™::
< div class=???article-content??? >
< h1 > :: article.title:: < /h1 >
< p class=???abstract??? > :: article.abstract:: < /p >
::raw article.content::
< /div >
::end::
The purpose of the preceding code is to capture the content of the main template in the special variable
with predefined name __content__, and then to output its value in the layout template. Note
that because the current template and the included wrapper template share the same context, it is
possible to refer to the article.title variable also inside the layout template as it is done in the
< title > < /title > element.
Using Macros with Templo
A macro is another way to avoid repeating common pieces of template all over the place. A macro has
the aspect of a function in the sense that it accepts arguments that define a scope inside the macro body,
but its definition is not haXe code but template code.
Pages:
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524