eZ Community » Forums » Developer » Function "xxx" is not registered
expandshrink

Function "xxx" is not registered

Function "xxx" is not registered

Thursday 10 December 2009 4:32:34 pm - 2 replies

Hi there,

I currently have a problem writing template operators.

I used Felix Woldt's tutorial who works very well but I would like to use different operators and not a single operator with different behaviour based on arguments.

So, I tried something like this :

eztemplateautoload.php

<?php
 
    $eZTemplateOperatorArray = array();
 
 
  $eZTemplateOperatorArray[] = array(    'script' => 
'extension/moo/autoloads/mooperator.php', 
 
                  'class' => 'MOOperator',
 
                     'operator_names' => array(
 
 
 
          'moo',
 
 'moo_hello_world'
 
 
                                          ) ); 
?>

mooperator.php

<?php
 
    class MOOperator{
 
        function MOOperator(){}
 
        function operatorList(){
 
            return array(
 
                'moo',
                'moo_hello_world'
 
            );
 
        }
 
        function namedParameterPerOperator(){
 
            return true;
 
        }
 
        function namedParameterList(){
 
            return array(
 
                'moo' => array( 'params' => array() ),
 
                'moo_hello_world'     => array(     
                                                    'params' => array(  'type' => 'array', 'required' => false, 'default' => array()  )
                                                )
 
            );
 
        }
 
        function modify(     $tpl, 
                            $operatorName, 
                            $operatorParameters, 
                            $rootNamespace, 
                            $currentNamespace, 
                            $operatorValue, 
                            $namedParameters){
 
            switch($operatorName){
 
                case "moo":
                    // $namedParameters['result_type'];
                    $operatorValue = "";
                    break;
 
                case "moo_hello_world":
                    $operatorValue = Test::helloWorld();
                    break;
 
            }
 
        }
 
    }
 
?>

But nothing appends.

eZ Debug

Undefined index:  moo in /var/www/espace/lib/eztemplate/classes/eztemplate.php on line 660
Function "moo" is not registered

Could you say to me what is wrong with my code ?

I used Felix's tutorial and I used the code of ezstarrating and I don't see where I made mistakes...

Thanks

Damien

Modified on Thursday 10 December 2009 4:49:29 pm by Damien MARTIN

Thursday 17 December 2009 6:36:10 pm

Hello there, try to regenerate autoload classes:

sudo php bin/php/ezpgenerateautoloads.php

Sunday 17 January 2010 4:26:54 pm

Note that in your template you should call {moo()} with parentheses, even if there are no arguments. Just using {moo} does not work and produces a 'Function "moo" is not registered' message.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from