Hi,
I’m writing an xml-file for a Flash-site, but in the CDATA of the xml-file there’s always a space before the content, which also shows in the Flash-file.
I have this chunk(pagetext):
<pageText><![CDATA[ [+content+] ]]></pageText>
It’s a template for a Ditto call, but when I delete the spaces before and after [+content+], the Ditto call doesn’t work anymore:
[!Ditto? &parents=`25` &tpl=`pagetext` &sortDir=`ASC`!]
If I keep the spaces before and after [+content+], the Ditto call works, but it shows a space in my xml and Flash.
Is there a way to remove those spaces?
Thanks in advance!
Don't believe anything you read on the net. Except this.
-
MODX Staff
- 10,725 Posts
You can also try using a phX custom modifier to wrap the value in CDATA tags as it is processed, which should avoid the whole conflict.
Hi,
phx seems to be the fastest and most efficient solution, but I’m new to modx so I don’t really know how to implement this.
Do you have a reference or can you give me an example?
thanks!
Don't believe anything you read on the net. Except this.
Great! I wrote a phx custom modifier and it works!
snippet phx:cdata
<?php
if (!function_exists('cdata')){
function cdata($inhoud){
$before='<![CDATA[';
$after=']]>';
return $before.$inhoud.$after;}
}
return cdata($output);
?>
usage: [+content:cdata+]
Don't believe anything you read on the net. Except this.