Hi,

I use ZPT with zope and I was checking out PHPTAL. One fundamental issue I found is that a variable defined in a macro is not made available to the elements of the calling zpt. That is, given this macro, peopleMain.zpt

<html   metal:define-macro="main"  tal:define="people php:peopleGet()">
<head>
</head>
<body>

<div metal:define-slot="content_main">
</div>

</body>
</html>

which is being used as [Browser] -> people.php -> people.zpt -> peopleMain.zpt

where peopleGet is a function in people.php which processes the template people.zpt which is:

<html metal:use-macro="person.zpt/main"><head>
</head>
<body>
<div metal:fill-slot="content_main">
<ul>
<li tal:repeat="user people" tal:content="user/name"></li>
</ul>
</div>
</body>
</html>

I get the error:

exception 'PHPTAL_VariableNotFoundException' with message 'Unable to find variable 'people' in current scope' in /var/www/PHP/people.zpt

This is a real pity, because in the same way that people.zpt defines the common elements of a web site, so would do the global variable people, ie, keeping all the common data for all the pages. This limitation (bug?) forces to include a call to peopleGet in all php/zpt pages.

Regards,
Fernando

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

Reply via email to