Simple question?

Simple question?

by Willie Flame -
Number of replies: 2

I’m new to Moodle and I’m having difficulty running a script can anyone please help?

We have set up a courser and in one of the pages we want to run an animated collapsible script

Here is the script we want to run: http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

I believe the reason for the script is not working is due to an incorrect file path.

I have updated the “animatedcollapse.js” file into the following folder. coursename1/scripts/animatedcollapse.js

In the text editor for the content page I want to run the script we have added the following:

__________________________



<script type="text/javascript" src=" file.php/coursename1/scripts/animatedcollapse.js"></script>


 

THE REST OF THE CODE NEED TO RUN THE SCRIPT IS BELOW THE ABOVE LINE


__________________________

Is my file path incorrect? We use this for our images and flash files with no issues? file.php/coursename1/flash/211.swf

Any ideas?

Average of ratings: -
In reply to Willie Flame

Re: Simple question?

by Jon Bolton -
Picture of Testers

Hi Willie, the <script type...>blah</script> has to be in the header of your page. You'll need to add it to header.html in your theme directory. The advantage is that you can then use the script in any of your pages.

The rest of the code can then be inserted into your page as resource (web page) or as an HTML block.

In reply to Willie Flame

Re: Simple question?

by Lance Haysom -
what is the error/s the script is generating?

strictly speaking the code doesn't have to be in the header but it would be better for re usability.

Why not pass it an absolute URL instead of a relative?