Hi list,
I think I found a bug when using Templo and php:
Following the advice on the haxe page,
http://haxe.org/com/libs/mtwin/temploI tried using templo with the following pattern
design.mtt :
<html>
<head>
<title>My title</title>
</head>
<body>
<h1>My title</h1>
<!-- assume the template which will use design.mtt fills the content variable -->
::raw content::
</body>
</html>
mypage.mtt :
::use 'design.mtt'::
::fill content::
<h2>My page</h2>
some data here
::end::
::end::
When using the above templates witn the Loader instance.execute(context), It works, but in the ouptut I get a "null" (a string saying null) at the very top, before the text output of the page. So, it appears before any doctype I put on my page, pushing browsers to quirks mode. Any idea what can be happening? Using haxe 3.1.0, latest Templo from haxelib.
Sample code:
install Templo from haxelib
save the above described templates.
Demo.hx:
import templo.Loader;
class Demo{
public static function main(){
Loader.BASE_DIR = php.Web.getCwd() + "/tpl/";
Loader.TMP_DIR = php.Web.getCwd() + "/tmp/";
Loader.MACROS = null;
Loader.OPTIMIZED = false;
var t = new Loader("mypage.mtt");
var ctx = {x:0};
php.Lib.print(t.execute(ctx));
}
}
Expected output:
My title
My page
some data here
received output:
null
My title
My page
some data here