|
Re: Problem including javascript functions in EPF [message #1417659 is a reply to message #1403970] |
Fri, 05 September 2014 21:23 |
Bruce MacIsaac Messages: 61 Registered: July 2009 |
Member |
|
|
The problem lies in the "tidy" feature of the RMC rich text editor. When you "save", the tidy feature changes the javascript, sometimes introducing errors.
I've also observed issues with publishing as well.
There are a few solutions to try:
1. You can change the javascript so that tidy and publishing doesn't change it.
For example, I noticed that some characters, like "<" were not handled correctly, so I did the following:
var left=String.fromCharCode(60)
Then I used "left" in strings where I needed a left angle bracket.
It takes some trial and error to get this approach to work.
2. Use an external javascript file, e.g.
<SCRIPT SRC="filename.js">
But if only it was so easy. Unlike graphic files, which RMC recognizes as being associated with the page, javascript files are not copied at publishing time.
The workaround is to add a template, or some other element that supports file attachments, and attach the file to that element. Now the javascript file will be copied over at publication time.
However, you will have to use a relative path to refer to it.
For example, to reference a filename.js script attached to a template but referenced from a concept, the path would be ../templates/resources/filename.js
|
|
|
Powered by
FUDForum. Page generated in 0.04480 seconds