Pb custom function

Author Message

Alexandre Mironenkov

Tuesday 13 January 2009 8:18:10 am

Hi,

I tried to write a custom foction "hello" in php.

Function_definition.php :

$FunctionList['hello'] = array( 'name' => 'hello',
                                  'operation_types' => array( 'read' ),
                                  'call_method' => array( 'include_file' => 'extension/ezflow/modules/ezflow/functioncollection.php',
                                                          'class' => 'eZFlowFunctionCollection',
                                                          'method' => 'fetchHi' ),
                                  'parameter_type' => 'standard',
                                  'parameters' => array(
                                      array( 'name' => 'text',
                                             'type' => 'string',
                                             'required' => true ),
                                  ) );

functioncollection.php :

	function fetchHi( $blockID )
    {
		$result="Hello, ".$text;
        return (string)$result;
    }

To see the result:

{def $fun=fetch('ezflow','hello',hash(text,"Alex"))}
        Output from function is : {$fun}
{undef $fun}

but me my function back only the first letter "H" :

Output from function is : H

Somebody have an idea why I do not get "Hello Alex" ?

Alexandre Mironenkov

Wednesday 14 January 2009 12:24:13 am

problem solved

functioncollection.php :

function fetchHi( $text )
{return array('result' => "Hello, ".$text);}

Jean-Yves Zinsou

Thursday 26 February 2009 5:04:44 am

Hi,
there is also a handy extensions that allows you to extend template language with your custom functions:
http://projects.ez.no/wrap_operator

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

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 31 2025 01:19:55
Script start
Timing: Jan 31 2025 01:19:55
Module start 'layout'
Timing: Jan 31 2025 01:19:55
Module start 'content'
Timing: Jan 31 2025 01:19:56
Module end 'content'
Timing: Jan 31 2025 01:19:56
Script end

Main resources:

Total runtime1.0840 sec
Peak memory usage8,192.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 588.0078151.1953
Module start 'layout' 0.00440.0037 739.2031220.6563
Module start 'content' 0.00811.0751 959.85944,442.2422
Module end 'content' 1.08320.0008 5,402.101612.1875
Script end 1.0840  5,414.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3166160.0002
Check MTime0.00120.1117160.0001
Mysql Total
Database connection0.00060.059410.0006
Mysqli_queries0.999992.2418570.0175
Looping result0.00050.0469550.0000
Template Total1.028994.920.5144
Template load0.00180.167320.0009
Template processing1.027094.741820.5135
Template load and register function0.00200.188610.0020
states
state_id_array0.00130.121910.0013
state_identifier_array0.00080.076220.0004
Override
Cache load0.00150.1357230.0001
Sytem overhead
Fetch class attribute can translate value0.00150.138020.0007
Fetch class attribute name0.00280.255140.0007
XML
Image XML parsing0.00210.190920.0010
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00220.2023160.0001
String conversion0.00000.000640.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs