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.