Wednesday 22 February 2006 1:39:37 am
Hi, I'm trying to make a "top 10" template operator which gets a list of users and teir created objects:
function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
&$currentNamespace, &$operatorValue, &$namedParameters )
{
switch ( $operatorName )
{
case 'topauthors':
{
$db =& eZDB::instance();
$query="SELECT `owner_id` , count( `owner_id` ) AS user_count
FROM `ezcontentobject`
WHERE `contentclass_id` = '".$namedParameters['class_id']."'
AND `status` = '1'
GROUP BY `owner_id`
ORDER BY `user_count` DESC
LIMIT 0 , ".$namedParameters['limit'];
$ResultArray = $db->arrayQuery( $query );
echo "<pre>Values:<br/>";
var_dump ($ResultArray);
echo "</pre>";
$operatorValue = $ResultArray;
} break;
}
}
The function works fine, but I have the problem that the $ResultArray is not passed back to the template correctly:
<hr/>
{set $topten = topauthors('16','10')}
<hr/>
{$topten|attribute(show)}
The returned results is empty, even if the SQL returns the correct array.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Attribute Type Value
It seems like
$operatorValue = $ResultArray;
isn't the correct way to pass the array back to the template. Can anyone give me a advice how to do that? Thanks in advance
Mit freundlichen Grüßen
Best regards
Norman Leutner
____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh
|