I have a code that look like this.
$language = "eng";
$append = "_sidebar.txt";
$read_text_file = "languages\\$language$append";
$sidebar = file($read_text_file);
$smarty->assign("sidebar_link",$sidebar);
Why does all variables in smarty all look like this:
Smarty_Variable Object (3)
->value = Array (13)
0 => "XX<i>\r</i><i>\n</i>"
1 => "XX<i>\r</i><i>\n</i>"
2 => "XX<i>\r</i><i>\n</i>"
3 => "XX<i>\r</i><i>\n</i>"
4 => "XX<i>\r</i><i>\n</i>"
with the XX representing single words. Where does \r\n come from??
The
\r\nis simply a windows linefeed (i.e. an “enter” key press) at the end of the lines that are being read from your file.You could either remove all line breaks in the file, or you could follow the instructions on this forum post to apply a strip (or a variation) filter to make Smarty filter out the control characters for you.