Share » Forums » Setup & design » remove return carriage from XML output

remove return carriage from XML output

remove return carriage from XML output

Monday 09 May 2011 2:07:10 am - 6 replies

Author Message

Marko Žmak

Monday 09 May 2011 3:07:04 am

You should replace the newline character with an empty string of space. Since there's no string replace operator in eZP you'll have to use some extension that allows you to do it. For example wrap operator, which allows you to execute any PHP function. Or you can search on projects.ez.no for an extension that implements the string replace operator.

To eZ team: it's a real shame that eZP by default lacks such basic and essential operators for string manipulation.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Jean-Baptiste Crestot

Monday 09 May 2011 3:29:52 am

Oh god...

Thank you Marko for your reply. wrap operator seems good.

Quoc Huy Nguyen Dinh

Monday 09 May 2011 4:16:39 am

Alternatively you could do

{def $outputXML = $myObject.data_map.myBlocXML.content.output.output_text|explode("\n")|implode(" ")}

Not tested though...

Jean-Baptiste Crestot

Monday 09 May 2011 4:41:26 am

Alternatively you could do

{def $outputXML = $myObject.data_map.myBlocXML.content.output.output_text|explode("\n")|implode(" ")}

Not tested though...

Thank's for answer, but it doesn't work. :(

Edit: actually I made a mistake, something else break my code but this code work properly!

Thank you a lot.

Jean-Baptiste Crestot

Monday 09 May 2011 8:08:48 am

Hum,

I know that I shouldn't ask my question in the same topic, but that's the same solution.

Now, my pb is that simple quote break my code, couldn't I do this :

{def $outputXML = $myObject.data_map.myBlocXML.content.output.output_text|explode("\n")|implode(" ")|explode(" ' ")|implode(" \' ")} (without spaces of course)

or

{def $outputXML = $myObject.data_map.myBlocXML.content.output.output_text|explode("\n")|implode(" ")}

{$outputXML|explode(" ' ")|implode(" \' ")} (without spaces of course)

Jean-Baptiste Crestot

Tuesday 10 May 2011 3:21:00 am

Okey, I guess it's not possible to do two explode implode during the same time.

And for my second purpose, it was missing the set $outputXML = $outputXML|explo...)

But finaly, I don't used this method.

I used the addslashes from php (by adding PHPOperatorList[addslashes=addslashes] in template.ini) and making :

myObject.data_map.myBlocXML.content.output.output_text|explode("\n")|implode(" ")|addslashes()}

Thanks for your help.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu