Prev | Current Page 515 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The second macro accepts a list (an Iterator or Iterable object) and displays its elements
in a standard (X)HTML list.
The template body that makes use of the preceding macros, can be something like this:
$$image(::image.uri::, ::image.alt::, ::image.link::)
$$zebraList(::names::)
The macros can remove a lot of redundancy in the template code; errors are easier to manage because
they have to be fixed just once in the macros file, the template code is easier to read because it is shorter
and because macro names add semantic to it.
Part II: Server Side, JavaScript, and Flash; Oh My!
268
On the haXe side, the code to make the example work is the following.
import mtwin.templo.Loader;
import mtwin.templo.Template;
class Main
{
public static function main()
{
Loader.BASE_DIR = ???d:\\templates\\???; // replace with a valid dir
Loader.TMP_DIR = ???d:\\compiled\\???; // replace with a valid dir
Loader.MACROS = ???macros.xml???;
Loader.OPTIMIZED = false;
var t = new Template(???macros-template.mtt???);
var r = t.


Pages:
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527