Share » Forums » General » format a number

format a number

format a number

Thursday 09 November 2006 1:35:38 am - 4 replies

Author Message

Xavier Dutoit

Thursday 09 November 2006 1:52:13 am

Hi Claudia,

The default way of adding a php function works only if you have one parameter to this function. I suppose that's not the case for you. I'm afraid it means creating an extension to add this template.

See this doc:

http://ez.no/products/ez_publish/documentation/development/extensions/template_operator

X+

http://www.sydesy.com

Claudia Kosny

Thursday 09 November 2006 2:46:48 am

Hi Xavier

Writing my own extension for this is no problem at all, actually I have done so already meanwhile. I just was wondering whether there is a way to do it using existing eZfunctions as I don't want to add more custom code than necessary.

Claudia

Xavier Dutoit

Thursday 09 November 2006 4:31:04 am

Hi,

You can add php functions as template function from within the template.ini.append

[PHP]
# A list with php functions and their equivelant template operator names
# Giving the operators a different name from the PHP functions
# are recommended, that way you ensure that all operators follow
# the same naming guidelines. It also means that you can change the
# php function later on without doing template changes.
PHPOperatorList[]
PHPOperatorList[urlencode]=urlencode

The only problem is that you can then only use them as $blabla|urlencode() . If the php function you plan to use needs more than one parameter, then you need to write an extension.

X+

http://www.sydesy.com

Xavier Dutoit

Thursday 09 November 2006 4:34:12 am

BTW, could you add your function in the contrib ?

X+

http://www.sydesy.com

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

36 542 Users on board!

Forums menu