Function "xxx" is not registered

Author Message

Damien MARTIN

Thursday 10 December 2009 7:32:34 am

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

Jean-Luc Nguyen

Thursday 17 December 2009 9:36:10 am

Hello there, try to regenerate autoload classes:

sudo php bin/php/ezpgenerateautoloads.php

http://www.acidre.com

Giovanni Gigante

Sunday 17 January 2010 7:26:54 am

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.

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 15:13:57
Script start
Timing: Jan 18 2025 15:13:57
Module start 'layout'
Timing: Jan 18 2025 15:13:57
Module start 'content'
Timing: Jan 18 2025 15:13:58
Module end 'content'
Timing: Jan 18 2025 15:13:58
Script end

Main resources:

Total runtime0.7959 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0072 587.9141152.6250
Module start 'layout' 0.00720.0030 740.539139.4453
Module start 'content' 0.01020.7842 779.9844588.2500
Module end 'content' 0.79440.0014 1,368.234412.1563
Script end 0.7958  1,380.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3828160.0002
Check MTime0.00130.1642160.0001
Mysql Total
Database connection0.00090.114710.0009
Mysqli_queries0.741693.1763600.0124
Looping result0.00060.0800580.0000
Template Total0.762195.820.3810
Template load0.00240.299520.0012
Template processing0.759795.454220.3798
Template load and register function0.00010.009910.0001
states
state_id_array0.00080.105810.0008
state_identifier_array0.00170.211920.0008
Override
Cache load0.00200.2552300.0001
Sytem overhead
Fetch class attribute can translate value0.00050.061430.0002
Fetch class attribute name0.00110.134750.0002
XML
Image XML parsing0.00110.135430.0004
class_abstraction
Instantiating content class attribute0.00000.000850.0000
General
dbfile0.00160.2013220.0001
String conversion0.00000.001240.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs