Hi People.
I know this is a dumb question, but...
I am about to revamp my old CMSMS site and I want to use several Javascripts to call items including my own image gallery.
Should I put the Javascript files in Global content blocks or is it best done another way.
Thanks.
Mike.
[Solved] Using Javascripts
[Solved] Using Javascripts
Last edited by Muzzy on Sat Apr 21, 2007 3:42 pm, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Using Javascripts
GCB's work great. especially if they're going to be re-used across templates and/or pages.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Using Javascripts
As a webmaster, you are aware that Firefoxers may install NoScript ?
https://addons.mozilla.org/fr/firefox/addon/722
...and that Konqueror users may disable JS too ?
But I think your GCB idea is better than messing inside HTML.
Pierre M.
https://addons.mozilla.org/fr/firefox/addon/722
...and that Konqueror users may disable JS too ?
But I think your GCB idea is better than messing inside HTML.
Pierre M.
Re: Using Javascripts
the javascript can be put in the template or in a global content block. just don't forget the {literal}{/literal} tags.
If you put the javascript in the template, you'll have faster loading because one global content block is one mysql query.
If you put it in gcb you'll have a cleaner template and easyer editing later.
Hope that answers your question.
If you put the javascript in the template, you'll have faster loading because one global content block is one mysql query.
If you put it in gcb you'll have a cleaner template and easyer editing later.
Hope that answers your question.
Re: Using Javascripts
Hi Guys.
Many thanks for the speedy reply and excellent guidance.
Thanks.
Mike.
Many thanks for the speedy reply and excellent guidance.
Thanks.
Mike.
Re: Using Javascripts
Personally I prefer using external javascript files. This way they are cached by the browser so they can be reused on other pages without data transfer/db queries. Also, in my experience the Javascript on a site is seldom changed once it is written.
Regards,
D
Code: Select all
<__script__ type="text/javascript" src="/path/to/cmsmadesimple/js/thescript.js"></__script>
D
Re: Using Javascripts
Hi Dee.
Thanks. So basically you are saying use the Javascripts called from within the page to a seperate folder on my server, much as I do for my old html sites before css/xhtml.
Bless you.
Mike.
Thanks. So basically you are saying use the Javascripts called from within the page to a seperate folder on my server, much as I do for my old html sites before css/xhtml.
Bless you.
Mike.
Re: Using Javascripts
Indeed, in XHTML script elements are wrapped within a CDATA marked section or put in external scripts if they use or --.
There are no differences with HTML4.0.1 in how you can specify a src URI to include an external script.
Regards,
D
There are no differences with HTML4.0.1 in how you can specify a src URI to include an external script.
Regards,
D