This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Setup & design » Embedding PHP within templates
expandshrink

Embedding PHP within templates

Embedding PHP within templates

Monday 04 April 2011 8:07:23 pm - 4 replies

Hi,

How easy is it to embed PHP within template files?

Can you give me any step-by-step examples of how to do it please?

Thanks,

Andy

Monday 04 April 2011 8:43:51 pm

Hi Andy,

It is not possible directly. The way is to extend the template engine/language through :

Cheers,

Monday 04 April 2011 11:01:57 pm

Also, the wrap operator extension could be usefull:

It's a wrapper that allows you to use any PHP function inside the eZP templates.

Of course, you must use this wisely and with caution.

Modified on Tuesday 05 April 2011 9:33:25 am by Mavko Žmak - Žmale

Tuesday 05 April 2011 9:06:23 am

Hi Marko,

Thank you for your help - can you tell me what I need to be careful of when using PHP please?

Andy

Tuesday 05 April 2011 9:33:05 am

Hi Marko,

Thank you for your help - can you tell me what I need to be careful of when using PHP please?

Andy

Well you'll have to be caerfull about pretty much the same thing when coding in pure PHP. Performance and security issues mostly. To make a list of it would be out of the scope for this forum.

The main "problem" is that when you use the eZP template language, the eZP itself takes care of many performance and security issues, and if you use much PHP within templates you lose this layer of protection.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from