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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:13:52
Script start
Timing: Jan 18 2025 16:13:52
Module start 'layout'
Timing: Jan 18 2025 16:13:52
Module start 'content'
Timing: Jan 18 2025 16:13:52
Module end 'content'
Timing: Jan 18 2025 16:13:52
Script end

Main resources:

Total runtime0.6781 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 589.1563152.6250
Module start 'layout' 0.00530.0030 741.781339.4453
Module start 'content' 0.00830.6683 781.2266523.7188
Module end 'content' 0.67650.0015 1,304.94538.1563
Script end 0.6780  1,313.1016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4375160.0002
Check MTime0.00130.1845160.0001
Mysql Total
Database connection0.00090.132910.0009
Mysqli_queries0.632393.2554540.0117
Looping result0.00050.0755520.0000
Template Total0.654096.520.3270
Template load0.00200.296020.0010
Template processing0.652096.155720.3260
Template load and register function0.00020.026310.0002
states
state_id_array0.00050.071710.0005
state_identifier_array0.00080.114920.0004
Override
Cache load0.00160.2353170.0001
Sytem overhead
Fetch class attribute can translate value0.00060.089920.0003
Fetch class attribute name0.00100.145830.0003
XML
Image XML parsing0.00080.116520.0004
class_abstraction
Instantiating content class attribute0.00000.001230.0000
General
dbfile0.00080.1109170.0000
String conversion0.00000.003540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs