Ahhh this is a common issue. When you're working in smartEdit RedDot  
looks for the <body>  tag so it can place some reddot code in there  
for the dots. If it can't find the body tag, it helpfully adds it for  
you as it adds in it's own code... instantly invalidating your code  
and causing all sorts of errors to appear. This will also be happening  
to your stylesheets; it just won't be as apparent.

There are a couple of options to work around this :

1) In your JS files make the first line  /* <body></body> */ . This  
gives RedDot somewhere to put it's script so it doesn't break your  
project.

or

2) In your link you can add a little bit of extra code so it looks  
like <script src="file.js<!IoRangeRedDotMode>&script=1</! 
IoRangeRedDotMode>" type="text/javascript"></script> This is supposed  
to tell RedDot to not append anything into the script file, but we've  
seen it cause other issues, especially when switching between  
smartEdit and smartTree.

Finally the best option that we've come across...

3) In addition to your anchor you can set up a container in your  
template. Reference the container to your anchor so that the contents  
of your JS file appears in the container. Hide the container outside  
of RedDot and hide the anchor inside smartEdit so that it looks  
something like this :

<!IoRangeNoRedDotMode>
        <script src="file.js" type="text/javascript"></script>
</!IoRangeNoRedDotMode>
<!IoRangeRedDotMode>
        <%cnt_javascript%>
</!IoRangeRedDotMode>

This has a double benefit. Your pages will no longer cause errors in  
smartEdit and you should also see a slight speed improvement for the  
editors as RedDot will be rendering one page instead of two each time  
a page is loaded.



On 2 Mar 2009, at 15:27, fred2028 wrote:

>
> In plain HTML:
>
> <script src="file.js" type="text/javascript"></script>
>
> In RedDot, I made a template of type JS and file extension JS, then
> copied everything between <script type="text/javascript"> and </
> script> into the content class template (much like how a traditional
> JS file is made). In my foundation page that uses the JS, I made an
> anchor placeholder and put it in place of file.js in the above
> example. I made an instance of the JS content class and put the page
> in clipboard, then referenced my anchor placeholder to this file.
> However, this does not work, gives me JS errors when I SmartEdit, and
> the page renders as if no JS is present.
>
> What is the proper way to reference an external JS file without using
> media placeholders?
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"RedDot CMS Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RedDot-CMS-Users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to