Prev | Current Page 484 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Templates are created in a way that a web designer with only HTML experience can write them
without any problem; of course he or she will have to stick to some rules described later.
??‘
??‘
??‘
??‘
??‘
??‘
??‘
??‘
Part II: Server Side, JavaScript, and Flash; Oh My!
252
haXe is all about portability but there are exceptions to this rule. Templating relies on the usage of the
EReg class (regular expression), which is not available on Flash prior to version 9. This means that the
template system will not work on Flash 8 or previous versions. All the other platforms are equally
supported.
The Template Class
The Template class is part of the haXe package and it is one of the possible approaches to template
processing. Its usage is straightforward. First the class must be instantiated; the constructor accepts a
single string argument that is the template content. Then the only public method available, execute() ,
must be invoked to process the template. The placeholders in the template are replaced by the variable
values in the object passed as an argument to the execute() method.


Pages:
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496