Forums / Setup & design / Error with Module

Error with Module

Author Message

Daniel Guerrier

Wednesday 17 August 2005 1:14:56 pm

I'm trying to create a module and a test run gives this message.

Error: eZModuleFunctionInfo::execute  	Aug 17 2005 16:10:04

No such function 'getDownloadCount' in module 's2htopten'

I defined a module.php with this:

<?php

$Module = array( "name" => "s2htopten" );

$ViewList = array();

?>

my function_definition.php has

<?php
$FunctionList = array();

$FunctionList['s2htopten'] = array('name' => 's2htopten',
								'operation_types' => array('read'),
								'call_method' => array('include_file' => 'extension/s2htopten/modules/s2htopten/s2htopten.php',
													   'class' => 's2htopten',
													   'method' => 'getDownloadCount' ),
                                 'parameter_type' => 'standard',
                                 'parameters' => array( array( 'name' => 'id',
                                                               'type' => 'integer',
                                                               'required' => true ) ) );

?>

I have a class file called s2htopten with this:

<?php
class s2htopten
{
	function s2htopten(){}
	
	function &getDownloadCount($id)

	{
		return array('result' => 'This better work');
	}

}


?>

When I perform a test using this code I get the message seen above:

{let testingplease=fetch( 's2htopten', 'getDownloadCount', hash( 'id', 119) )}
I hope This freakin thing works : {$testingplease}
{/let}

added the following to my site.ini:

ActiveAccessExtensions[]=s2htopten

Is there something that I am missing.
I've been going in circles and hope another set of eyes can quickly pick up the issue.

Thanks

Daniel Guerrier

Thursday 18 August 2005 7:21:05 am

anyone have an idea what might be the problem?
I started from scratch and came to the same point.

Daniel Guerrier

Friday 19 August 2005 10:38:27 am

Does anyone have an idea of what is wrong?

Daniel Guerrier

Saturday 20 August 2005 12:33:09 pm

I guess I should assume I'm on my own with this one?

Bertrand Dunogier

Sunday 28 August 2005 11:13:56 am

Err Daniel, somethins is wrong with your definition (you may have guessed that already ^^):

$Module = array( "name" => "s2htopten" );

Your module name is s2htopten, okay.$

$FunctionList['s2htopten']

You define a function named like the module (?!)

{let testingplease=fetch( 's2htopten', 'getDownloadCount', hash( 'id', 119) )}

you try to call the getDownloadCount function of the s2htopten module... and it has never been defined.

What you need is probably

$FunctionList['getDownloadCount'] = ...