I have a javascript that plays audio files on the page when you click on the play button. The current code which works properly looks like this:
<script type="text/javascript">player_button("/content/DEVELOPMENT/2012/courses/DEV-COURSENAME/FOLDERNAME/FILE.mp3");</script>
I was wondering how I can make the URL shorter so other course editors could copy and paste it into a different page? For example, I tried the following, and it didn't work, but this is what I would ideally like the code to be close to.
<script type="text/javascript">player_button(".../FOLDERNAME/FILE.mp3");</script>
So I guess what I am asking, is how to I find out the courses current path?
If you're including your javascript is appearing in HTML embedded within an LMS page, then you can try using the {OrgUnitPath}
replace string; if your HTML is passing through the LMS' page rendering engine in a way where replace strings are noticed and expanded, that replace string should expand to the path you require.
However, not all HTML that you can add to the LMS will pass through the LMS' page rendering engine in a way that notices replace strings: for example, if you're trying to serve this HTML up as content through the LE Content space, then this probably won't work.