| 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 |