Sunday 12 August 2007 9:14:33 pm
Hi Christian I'm not sure about this advice from the previous post. While you prolly can create your own custom fetch functions by creating your own php class which you can use with a custom template operator or module. It would be faster (re: development time) to simply create a custom template operator which does what you wish.I would suggest you instead consider creating your own template operators to meet your needs or perhaps use the wrap operator which is even faster to get started with :)
While you probably could use an template operator it's not the right "tool" and it isn't too hard to setup a fetch. Assuming you already have a module mystuff setup the following is all you need to do. In extension/mystuff/modules/mystuff/function_definition.php
<?php
$FunctionList = array();
$FunctionList['MyFetch'] = array( 'name' => 'myfetch',
'operation_types' => array( 'read' ),
'call_method' => array( 'include_file' => 'extension/mystuff/modules/mystuff/mystufffunctioncollection.php',
'class' => 'MyStuffFunctionCollection',
'method' => 'fetchMyFetch' ),
'parameter_type' => 'standard',
'parameters' => array(array('name' => 'some',
'type' => 'integer',
'required' => true,
'default' => -1
),
array('name' => 'params',
'type' => 'string',
'required' => true,
'default' => ''
)
)
);
?>
and in extension/mystuff/modules/mystuff/mystufffunctioncollection.php
<?php
class MyStuffFunctionCollection
{
function MyStuffFunctionCollection()
{
}
function &fetchMyFetch($some,$params)
{
$result =& retrieve data here
return array( 'result' => $result );
}
}
?>
HTH
Cheers Bruce
My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish
|