[opencms-dev] workplace gets confused when inserting JS script code in a page

Christian Steinert christian_steinert at web.de
Fri Aug 14 23:25:07 CEST 2009


Hi Chris
> When I insert the code snippet:
>
>
> <script type="text/javascript">
> 		// <![CDATA[
[snip ]
> 		
> 		// ]]>
> </script>
>
> in my page, I cannot save and exit the FCK-Editor. I'm getting:
>   
[snip]
> How can I get around this?
>   
I don't know whether you can get around this at all. Opencms saves 
content in xml files and the content is enclosed in CDATA blocks. So if 
you have your own CDATA block inside of the content, then you break out 
early of the enclosing CDATA that opencms wraps around your content.

Generally, the better way is to use your templates to mix scripts and 
content. In your templates it is no problem to add CDATA sections. This 
is not only a workaround for your specific issue but also much cleaner 
because it separates your content from the actual website that is 
generated. Even if opencms and fckeditor had no problem with inserting 
CDATA blocks into normal pages, I would still not recommend to mix 
content and scripts like that

christian-
> --
> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>   




More information about the opencms-dev mailing list