Wordwrap in Smarty
Wordwrap wraps string to a column width, default is 80. We can specify the length to wrap a text to that length. We can also cut off th string at exact character length by passing the optional third parameter of true.
<?php
$smarty->assign(’input’,
“This is test text which will use wordwrap.”
);
?>
where template is
{$input}
{$input|wordwrap:30}
{$input|wordwrap:20}
{$input|wordwrap:30:”<br />\n”}
Output
This is test text which will
use wordwrap.
This is test text
which will use wordwrap.
This is test text which will<br />
use wordwrap.
