Tuesday 29 June 2010 3:53:36 pm
Hi, can anyone go through this script and find out what is wrong with it. I have created a custom operator called "charactertrunc " to fetch fixed number of characters from content nodes.but after activating this extension getting Fatal error: eZ Publish did not finish its request The execution of eZ Publish was abruptly ended. Contact website owner with current url and what you did, and owner will be able to debug the issue further. I show you the code . files are extension/charactertrunc/autoloads/templatecharactertruncoperator.php extension/charactertrunc/autoloads/eztemplateautoload.php extension/charactertrunc/settings/site.ini.append 1. in site.ini.append
<?php
[TemplateSettings]
ExtensionAutoloadPath[]=charactertrunc ?> 2. in eztemplateautoload.php
<?php
// Operator autoloading
$eZTemplateOperatorArray = array();
$eZTemplateOperatorArray[] = array( 'script' => 'extension/charactertrunc/autoloads/templatecharactertruncoperator.php',
'class' => 'TemplateCharactertruncOperator',
'operator_names' => array( 'charactertrunc' ) ); ?> 3. in templatecharactertruncoperator.php
<?php
class TemplateCharactertruncOperator
{
function TemplateCharactertruncOperator()
{
}
function operatorList()
{
return array( 'charactertrunc' );
}
function namedParameterPerOperator()
{
return true;
}
function namedParameterList()
{
return array( 'charactertrunc' => array( 'number' => array( 'type' => 'integer',
'required' => false,
'default' => 0 ) ) );
}
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{
$number = $namedParameters['number'];
// Example code. This code must be modified to do what the operator should do. Currently it only trims text.
switch ( $operatorName )
{
case 'charactertrunc':
{
$operatorValue = $this->substr($operatorValue,0,$number);
} break;
}
}
} ?> I have put something wrong I hope a help plz . Thanks in advance Romeo.
|