Forums / Developer / get function name from returned value

get function name from returned value

Author Message

Matt Gifford

Monday 15 September 2008 5:13:08 am

Hi

Probably a simple question, and for this I apologise

I have a function returning a variable to my template. This returned value matches an extension function I have written, and I want to use it to dynamically fetch the function value.

For example, I am sending a value in the URL, which is the name of the function I want to use, and this is returned to the template as $this_method, which can be getrootnode.

I want to use this method name to actually call that function on the page, by turning the variable into the function call, e.g

{getrootnode()}

but this will not work: {$this_method()}

does anyone know how I can do this?

Many many thanks,

Matt

André R.

Monday 15 September 2008 9:26:44 am

You can 1. return a object with 'attribute' and 'hasAttribute' functions and use it like $my_object.call_function, 'call_function' will be first parameter of (has)attribute
or 2. create another function that takes this object as parameter and executes it from php.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom