Hi,

I have four test files:

1.
======= chunk.html ========
<div>
This is chunk of html :)
</div>
====== end of chunk.html =====


2.
====== layout.html =========
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html metal:define-macro="layout">
<head>
<title>Phptal test</title>
</head>
<body>
<h1 metal:define-slot="content"></h1>
</body>
</html>
===== end of layout.html ======


3.
======== test.html =========
<tal:block metal:use-macro="layout.html/layout">
<tal:block metal:fill-slot="content">
<span class="test" id="testId">Test</span>
</tal:block>
</tal:block>
======= end of test.html ======


4.
======== index.php =========
<?php
require_once 'PHPTAL-1.2.1/PHPTAL.php';
$outputMode = PHPTAL::XHTML;
// create a new template object
$tpl = new PHPTAL();
$tpl->setPhpCodeDestination('/tmp/');
$tpl->setOutputMode($outputMode);
$tpl->setTemplateRepository(dirname(__FILE__));
?>


/////////////////////// NO CLONE /////////////////////////


................chunk.html.....................


<?php
$tpl->setTemplate('chunk.html');
echo $tpl->execute();
?>


................test.html......................


<?php
$tpl->setTemplate('test.html');
echo $tpl->execute();
// create a new template object
$tpl = new PHPTAL();
$tpl->setPhpCodeDestination('/tmp/');
$tpl->setOutputMode($outputMode);
$tpl->setTemplateRepository(dirname(__FILE__));
?>


/////////////////// WITH CLONE //////////////////////////


.....................chunk.html...............


<?php
$tpl->setTemplate('chunk.html');
echo $tpl->execute();
$tpl2 = clone $tpl;
?>


.....................test.html.................


<?php
$tpl2->setTemplate('test.html');
echo $tpl2->execute();
?>
======== end of index.php =========


When I run index.php on localhost I get something like this:


========== RESULT =============


/////////////////////// NO CLONE /////////////////////////


................chunk.html.....................


<div>
This is chunk of html :)
</div>

................test.html......................


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
<head>
<title>Phptal test</title>
</head>
<body>

<span class="test" id="testId">Test</span>

</body>
</html>

/////////////////// WITH CLONE //////////////////////////


.....................chunk.html...............


<div>
This is chunk of html :)
</div>

.....................test.html.................


<html>
<head>
<title>Phptal test</title>
</head>
<body>

<span class="test" id="testId">Test</span>

</body>
</html>
=================== end of RESULT ============

After clone PHPTAL stripped doctype... Why ?

When I change output mode to HTML5, PHPTAL generates broken html (no quotes around attributes values, does not matter if after clone or before) and does not change/validate doctype in layout.html. Is this normal?

Thank you for help. :)

Regards
Piotr Kroczyński


Ps. sorry for my bad english.



_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to