Forums / Developer / How to execute code inside templates?

How to execute code inside templates?

Author Message

Francisco Felix

Friday 25 July 2003 1:45:12 pm

As I need this for change the design inserting external funcionality I posted this message first in the design forum, but I think this is a more suitable place. Sorry, it wont happen again.

I need to executePHP code directly inside templates in order to include external funcionality, for example our poll system or our banner ad server. I made tests and the PHP code come out as is when I included it in the template.

It seems that expanding PHP with specific functions and then writing our own template operator ( http://www.ez.no/developer/ez_publish_3/documentation/development/kernel/custom_template_operators ) would do it, but this method has big disadvantages.

I think tweaking the template rendering system would be sufficient to allow execution of PHP inside them and thus solving the problem, but right now I dont have the knowledge about the EZPublish system to do this and cant find that knowledge in the documentation either.

I have tried to understand the code from reading it (as EZPublish team suggests) but I have not that kind of talent.

Any help or tougths will be appreciated.

Alex Jones

Friday 25 July 2003 1:47:43 pm

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>When in doubt, clear the cache.</i>

Francisco Felix

Friday 25 July 2003 2:09:15 pm

Thanks a lot, a lot really for pointing that out Alex. I am already cheking it out and would continue at there.

What a fast response, what a community. You can bet that when I learn I will be here sharing with you all.

Alex Jones

Friday 25 July 2003 2:13:05 pm

Glad to hear it! I am still coming up to speed as the learning curve can be steep. But so far it hs proven quite worthwhile.

The more of us helping each other, the better of we will all be.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Francisco Felix

Friday 25 July 2003 2:21:51 pm

Check http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/including_php_files_in_templates

Jan Borsodi

Saturday 26 July 2003 4:11:52 am

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

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq