I have a Smarty Loop as below, for e.g:
{strip}
{assign "comma" ""}
{foreach from=$List item=Item}
{$comma}{$Item.title}
{assign "comma" ","}
{/foreach}
{/strip}
.. from which I EXPECT is:
Apple,
Banana,
Candy
.. WRITTEN as a FILE.
My PHP codes (to write the file) are:
$f = fopen('myfile.txt', 'w');
fwrite( $f, $smarty->fetch('sample.tpl') );
But instead IN REALITY, it is being written as like below:
Apple,Banana,Candy
Even if i use \r
or \r\n
in Smarty tpl
, they are just being printed out, as the characters themselfs.
Not breaking the lines anyway.
How to do it please?