Custom SmartyPlugin to generate XML from articles_vote table

Hi, I have to export all the comments from the customers on each article into an XML file. for that I write a smarty function in the folder /_private/smarty/function.articlesVote.php

function code:
function smarty_function_articlesVote($params, Smarty_Internal_Template $template)
$articleId = $params[‚articleid‘];
$sql = ‚SELECT,, av.comment, av.points, av.datum FROM s_articles_vote as av WHERE articleID = $articleId‘;
$data = Shopware()->Db()->fetchAll($sql);
foreach($data as $detail)
return [
‚id‘ => $detail[‚id‘],
‚name‘ => $detail[‚name‘],
‚points‘ => $detail[‚points‘],
‚datum‘ => $detail[‚datum‘],
‚comment‘ => $detail[‚comment‘]

calling the function in template body section like,
{articlesVote articleid = $sArticle.articleID}
{foreach $articlesVote as vote}




Error i am receiving:
„Syntax Error in template „ca203bed1f336069352ce377d06892e663233786“ on line 3 „{articlesVote articleid = $sArticle.articleID}“ unknown tag „articlesVote““ in engine/Library/Smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 657"

Can any one help me to improve this code to work?