Nl2br

nl2br — Inserts HTML line breaks before all newlines in a string

<?php
$tplix->assign('articleTitle',
                "Sun or rain expected\ntoday, dark tonight"
                );
Basic Usage:
{$article|nl2br}

Returns string with
or
inserted before all newlines (\r\n, \n\r, \n and \r).

Parameters:
Parameter Type Required Description
1 bool No true, Whether to use XHTML compatible line breaks or not.

Where the template is:


{$articleTitle|nl2br} # renders: Sun or rain expected<br />today, dark tonight
{$articleTitle|nl2br:true} # renders: Sun or rain expected<br />today, dark tonight
Was this article helpful?