# Custom SmartyPlugin to generate XML from articles\_vote table

**URL:** <https://forum.shopware.com/t/custom-smartyplugin-to-generate-xml-from-articles-vote-table/92824>\
**Category:** Plugins\
**Tags:** programming\
**Created:** [7. Februar 2022 um 14:40 UTC](https://forum.shopware.com/t/custom-smartyplugin-to-generate-xml-from-articles-vote-table/92824 "2022-02-07T14:40:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajay.maurya](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@ajay.maurya](https://forum.shopware.com/u/ajay.maurya)\
**Post date:** [7. Februar 2022 um 14:40 UTC](https://forum.shopware.com/t/custom-smartyplugin-to-generate-xml-from-articles-vote-table/92824/1 "2022-02-07T14:40:32Z")

</div>

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.id, av.name, 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}   
  
\<review\_id\>{$vote.id}\</review\_id\>  
  
{$vote.name}  
  
\<review\_timestamp\>{$vote.datum|date\_format:"%Y-%m-%dT%H:%M:%S+01:00"}\</review\_timestamp\>  
{$vote.comment|replace:"&":","}

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?
