new operator

Author Message

tic 9

Thursday 26 June 2008 4:48:45 am

hi!
I am spirit to develop a simple operator who does not make post just an end of sentence but the problem is that i have an error.
here all configurations:

in settings/my-siteaccess/site.ini

[ExtensionSettings]
ActiveAccessExtension[]=essai

I have in my extension:
extension/essai/ autoloads/eztemplateautoload.php

   <?php

                                    
                                    
                                    
                                 
$eZTemplateOperatorArray = array();
$eZTemplateOperatorArray[] = array( 'script' => 'extension/essai/autoloads/templatembuyi1operator.php',
                                    'class' => 'TemplateMbuyi1Operator',
                                    'operator_names' => array( 'mbuyi1' ) );
?>
 

and extension/essai/ autoloads/templatembuyi1operator.php

 


class TemplateMbuyi1Operator

{

<?php
    /*!
      Constructeur
    */
   function TemplateMbuyi1Operator
    {
    }

    /*!
     
return an array with the template operator name.
    */
    function operatorList()
    {
        return array( 'mbuyi1' );
    }
    /*!
     \return true to tell the template engine that the parameter list exists per operator type,
             this is needed for operator classes that have multiple operators.
    */
    function namedParameterPerOperator()
    {
        return true;
    }    /*!
     See eZTemplateOperator::namedParameterList
    */
    function namedParameterList()
    {
        return array( 'mbuyi1' =>  array('');
    }
    /*!
     Exécute la fonction PHP correspondant à l'opérateur "cleanup" et modifie \a $operatorValue.
    */
    function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters )
    {
      //  $firstParam = $namedParameters['first_param'];
       // $secondParam = $namedParameters['second_param'];
        // Exemple de code, ce code doit être modifié pour que l'opérateur fasse ce qu'il doit faire. Actuellement il effectue juste un "trim" du texte.
        switch ( $operatorName )
        {
            case 'mbuyi1':
            {
                   $operatorValue = $this->mbuyi1();
            } break;
        }
    }
    
    function mbuyi1()

   {

       return 'Hello World';

   }

 
/// privatesection

   var $Operators;

}

?>
 

in extension/essai/ settings/site.ini


<?php /* #?ini charset="iso-8859-1"?

# eZ publish configuration file for designs
[TemplateSettings]
ExtensionAutoloadPath[]=extension/essai/autoloads

*/ ?>
 

but, it don't run and I have this
eZTemplate @ extension/essai/design/standard/templates/pagelayout.tpl:59[5] Jun 26 2008 13:23:03

Operator 'mbuyi1' is not registered

Nicolas Ottavi

Thursday 26 June 2008 5:08:57 am

Hello

In your extension/essai/settings/site.ini.append.php you should have this

<?php /* #?ini charset="utf-8"?
[TemplateSettings]
ExtensionAutoloadPath[]=essai

*/ ?>

In your case you put extension/essai/autoloads in ExtensionAutoloadPath[] when you only need the extension folder name.

Hope it helps,
N.O

tic 9

Thursday 26 June 2008 5:29:33 am

Thank you very much for that!

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 16:15:30
Script start
Timing: Jan 18 2025 16:15:30
Module start 'layout'
Timing: Jan 18 2025 16:15:30
Module start 'content'
Timing: Jan 18 2025 16:15:31
Module end 'content'
Timing: Jan 18 2025 16:15:31
Script end

Main resources:

Total runtime1.3855 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7891152.6094
Module start 'layout' 0.00600.0033 740.398439.3984
Module start 'content' 0.00931.3747 779.7969483.7500
Module end 'content' 1.38400.0015 1,263.546912.2031
Script end 1.3855  1,275.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2431160.0002
Check MTime0.00130.0964160.0001
Mysql Total
Database connection0.00070.053010.0007
Mysqli_queries1.335496.3852570.0234
Looping result0.00060.0443550.0000
Template Total1.347997.320.6739
Template load0.00250.180320.0012
Template processing1.345497.102020.6727
Template load and register function0.00020.013210.0002
states
state_id_array0.00110.078610.0011
state_identifier_array0.00190.137920.0010
Override
Cache load0.00200.1445280.0001
Sytem overhead
Fetch class attribute can translate value0.00080.055120.0004
Fetch class attribute name0.00110.082030.0004
XML
Image XML parsing0.00040.026220.0002
class_abstraction
Instantiating content class attribute0.00000.000530.0000
General
dbfile0.00060.0456100.0001
String conversion0.00000.000740.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
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.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: 6

Time used to render debug report: 0.0001 secs