You may want to check out this thread (http://ez.no/developer/ez_publish_3/forum/general/php_support_in_templates) as the idea of PHP within templates is discussed by several of us, including the folks at eZ systems.
Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
I've added a suggestion on how code execution could be done, feel free to comment on it. http://ez.no/developer/ez_publish_3/forum/suggestions/php_execution_in_templates