On 21-09-2009 at 08:51:17 GRolf <ger...@pictureparking.com> wrote:
In these circumstances, using AJAX to retrieve only part of the page
is harder. Do you have any feedback on that? For maintenance and
support, I really really like to keep my templates grouped with the
script. I know I could create a "register_form.tpl",
"register_succeed.tpl", "register_failed.tpl" etc but this quickly
becomes a cumbersome operation to open/close all those docs, let alone
if you have a PHP script that runs through multiple, consequetive
forms.
One approach is to make interesting parts available as macros:
<tal:block metal:define-macro="foo">…</tal:block>
<tal:block metal:use-macro="foo"/>
With this pattern you continue to execute whole templates as before, but
you can also access the macro from another file (e.g. have PHP call
register_ajax.tpl that calls only macros you want).
If you always want to AJAX entire body of the page, then change:
<tal:block metal:use-macro="general.tpl/${templatename}">
and set templatename to either 'globalpage' or other minimal template for
AJAX response.
Or you can show/hide parts of the page depending on variable:
<body tal:omit-tag="ajax">
<div id="sidebar" tal:condition="not:ajax"/>
etc.
</body>
--
regards, Kornel
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal