xhtml keeps changing my javascript, pass-through code is not working.
What options do I have to include javascript? I keep getting a wellformed error with text blocks when including javascript. The xhtml block keeps changing my javascript....
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Eric L. Epps on 09 Feb, 2012 11:05 PM
I usually either have it as a separate .js file or put it in a text block and apply that block to a region just before the closing body tag. I've created regions called "script1" and "script2" so that, when a page needs custom JavaScript, I can easily put the JavaScript text block in one of those.
2 Posted by Charlie Holder on 20 Mar, 2012 01:22 PM
Following up with some older posts.
I also use external Javascript files when possible.
When I'm using an XHTML Block for Javascript, I usually turn off HTML Tidy. Because of this, I usually use an XML Block instead depending on the content I'm trying to store. If you're trying to submit only Javascript (or even a small amount of straight HTML) I would use an XML Block. I think it's great for entering HTML content that wouldn't lend itself to being managed through the WYSIWYG interface.
Hope this helps.
Charlie Holder closed this discussion on 03 Apr, 2012 08:26 PM.
ssuh re-opened this discussion on 30 May, 2012 08:11 PM
3 Posted by ssuh on 30 May, 2012 08:11 PM
Is there any way to get the CMS to recognize image links inside of a javascript file?
If I use a document.write(image link).
Steve
4 Posted by Artur on 30 May, 2012 09:03 PM
Yes, File assets have "Rewrite links in file" checkbox that needs to be checked first. Then, anything that is a link to another File or Page needs to be wrapped in [system-asset] tags. For example:
document.write('[system-asset]/path/to/file.jpg[/system-asset]')
Artur closed this discussion on 30 May, 2012 09:03 PM.
ssuh re-opened this discussion on 30 May, 2012 09:12 PM
5 Posted by ssuh on 30 May, 2012 09:12 PM
Does it work with string concatentation?
document.write('[system-asset]<img src="/_assets/images/mastheads/general/' + images[foo] +' [/system-asset]'+ '" border="0" alt="' + alt[foo] + '" title="' + alt[foo] + '" align="left" />');
Steve
6 Posted by Artur on 30 May, 2012 09:26 PM
No, between [system-asset] tags there must be path only. No
<img>
tag or anything concatenated. The only place that concatenation can occur is formats. For example, this will work:and will show a link to /starting-page correctly updated. However, even in this case, the link will not be managed by Cascade Server so that if you move or rename that page, the link will become broken.
However, if you have full path between [system-asset] tags, then that link will be managed by Cascade Server so that if you move or rename the linked-to asset, the link itself will get automatically updated.
Artur closed this discussion on 30 May, 2012 09:27 PM.
ssuh re-opened this discussion on 30 May, 2012 09:30 PM
7 Posted by ssuh on 30 May, 2012 09:30 PM
Thanks. We have a random image masthead with some javascript. It justs a document write to an image src with an array.
I guess we'll have to rethink this...
Steve
Bradley Wagner closed this discussion on 31 May, 2012 08:44 PM.