Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

smarty replace line breaks

Tags:

php

smarty

At the time of writing this, the smarty.net website appears to be down.

Anyway, how do I replace line breaks with a space in a smarty variable? Is it something like this {$var|regex_replace:'[\\r\\n]':'\s'} ? I tried it but it didn't work.

like image 950
John Avatar asked May 21 '11 00:05

John


1 Answers

Try this if it works:

{$var|regex_replace:"/[\r\n]/" : " "}
like image 160
tradyblix Avatar answered Oct 14 '22 10:10

tradyblix