I am loading an xml in php via simplexml_load_file().
I load the file with that:
$xml = simplexml_load_file('flash/datas/datas.xml');
And the access my content like that:
$descText = $xml->aboutModule->chocolaterie->desc
The text from desc is well registred in my $descText, but all the <br/> of the text disappear… So my long text is on a single line, not so good :-/
Do you know how to solve that? Is there a special traitement to do one the $xml var? Or someting else?
Thank you in advance for your help!
Two ways to make it work.
The right one
Do not store those
<br/>. Store the real actual newlines, e.g.Then use nl2br() to replace newlines with HTML tags. This is assuming your description does not normally contain markup. If it does, use CDATA sections as proposed in another answer.
The other one