On 18.09.2009, at 23:34, hosema...@poczta.onet.pl wrote:

Hi
I am working on ajax php website. Ajax makes using phptal more complicated. My approach is to divide single page to several php files and every time at single page i create new object of $tpl. It means that I have to use several $tpl->execute() at the first page load. I think it is not optimal. My question is whether there is most efective way to use phptal and ajax?

page.xhtml:

<body>
stuff
<tal:block metal:use-macro="widget.xhtml/show_widget" />
stuff
</body>


widget.xhtml:

<div metal:define-macro="show_widget">
ajax me!
</div>
<tal:block metal:use-macro="show_widget" />


This will let you either execute page.xhtml with all stuff in it, or execute widget.xhtml and just output that single fragment. You can use variables in use-macro (e.g. "show_${name}"), so you're not limited to one thing per file.

--
regards, Kornel




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

Reply via email to