[{assign var="sEnclosure" value='"'}]
[{assign var="sLineSeparator" value="@new_line@"}]
[{assign var="sFieldSeparator" value=","}]

[{*** special chars ***************}]
[{*  new line    => "@new_line@"  *}]
[{*  tab         => "@tab@"       *}]
[{*  white space => "@space@"     *}]
[{*********************************}]

[{strip}]
    [{capture assign="sHeadArea"}]
        [{if $aFieldList}]
            [{foreach name="fieldlist" key="key" from=$aFieldList item="sFieldName"}]
                [{$sEnclosure}][{$sFieldName}][{$sEnclosure}]
                [{if $smarty.foreach.fieldlist.last eq false}]
                    [{$sFieldSeparator}]
                [{else}]
                    [{$sLineSeparator}]
                [{/if}]
            [{/foreach}]
        [{/if}]
    [{/capture}]
[{/strip}]

[{strip}]
    [{capture assign="sContentArea"}]
        [{if $aContentList}]
            [{foreach name="contentlist" key="contentlistkey" from=$aContentList item="sContent"}]
                [{$sEnclosure}][{$sContent}][{$sEnclosure}]
                [{if $smarty.foreach.contentlist.last eq false}]
                    [{$sFieldSeparator}]
                [{else}]
                    [{$sLineSeparator}]
                [{/if}]
            [{/foreach}]
        [{/if}]
    [{/capture}]
[{/strip}]