I'm not sure what is wrong, but you may want to take a look at http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/including_php_files_in_templates
Perhaps it can help get you back on track.
Also, you may want to look at creating your own operator which is the prefered method. More information about: http://ez.no/developer/ez_publish_3/documentation/development/kernel/custom_template_operators
Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]