Prev | Current Page 501 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

use::: < a href=???mailto:::item.email::??? > ::item.email:: < /a >
< /li > ::end::
< /ul >
< /body >
< /html >
Then the Main.hx is created with the following content:
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
Chapter 10: Separating Design Using Templates
261
Loader.MACROS = null;
Loader.OPTIMIZED = false;
var t = new Template(???template.mtt???);
var r = t.execute({
name: ???John Doe???,
emails: [{
email: ???john.doe@example.com???,
use: ???work???
}, {
email: ???john@example.com???,
use: ???personal???
}]
});
neko.Lib.print(r);
}
}
Running the previous example in the Nekotools Server or Mod_Neko Apache will output a very basic
XHTML page.
Instead of using the mtwin.templo.Template constructor, it is possible to obtain the same results
using the mtwin.tempo.Loader constructor. The difference between the two is that the latter uses
temploc to compile the templates and, thus, this must be accessible by the system during the execution
as described earlier in the ??? Installing Templo ??? section.


Pages:
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513