I tried to past a Remarketing code into the umbraco backend but I got an exception. Here is the code:
<!-- Google Code for Remarketing List -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 1071937084;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "666666";
var google_conversion_label = "test";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1071937084/?label=test&guid=ON&script=0"/>
</div>
</noscript>
If I paste this into an umbraco textbox in the backend I get this exception:
Cannot have ']]>' inside an XML CDATA block.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Cannot have ']]>' inside an XML CDATA block.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Cannot have ']]>' inside an XML CDATA block.]
System.Xml.XmlTextWriter.WriteCData(String text) +185
System.Xml.XmlCDataSection.WriteTo(XmlWriter w) +25
System.Xml.XmlElement.WriteContentTo(XmlWriter w) +32
System.Xml.XmlElement.WriteTo(XmlWriter w) +157
System.Xml.XmlElement.WriteContentTo(XmlWriter w) +32
System.Xml.XmlElement.WriteTo(XmlWriter w) +157
System.Xml.XmlNode.get_OuterXml() +111
umbraco.cms.businesslogic.CMSNode.SavePreviewXml(XmlNode x, Guid versionId) +566
umbraco.cms.businesslogic.web.Document.SaveXmlPreview(XmlDocument xd) +98
umbraco.cms.businesslogic.web.Document.Save() +186
umbraco.cms.presentation.editContent.Save(Object sender, EventArgs e) +2193
System.EventHandler.Invoke(Object sender, EventArgs e) +0
umbraco.controls.ContentControl.saveClick(Object Sender, ImageClickEventArgs e) +453
umbraco.controls.ContentControl.savePublish(Object Sender, ImageClickEventArgs e) +48
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
So I tried a workaround. I created 2 properties (remarketingCDATA and remarketingScript) and wanted to build the rest of the code in XSLT. This way the data can be stored in Umbraco and XSLT eventually would render the correct script. Here is my XSLT:
Now I hoped this would render the code correctly, but it doesn't. Xslt comments some parts out because of the /* which is used. This is what is rendered:
Render CDATA with Xslt
Hello,
I tried to past a Remarketing code into the umbraco backend but I got an exception. Here is the code:
If I paste this into an umbraco textbox in the backend I get this exception:
Have a look at the examples here, you can concat the CDATA around it..
Thanks Sebastiaan!
Here is my sample which works:
Jeroen
is working on a reply...