Hi,
Forgive me if this has been asked before. I've searched but haven't found the particular answer I'm looking for:
I want to assemble a snippet of JS code that needs to go in the head section of a mod view.php page. For example:
<script src="js/swfobject.js" type="text/javascript" charset="utf-8"></script>
<script src="js/swfaddress.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
var attributes = {};
swfobject.embedSWF("file.swf", "myAlternativeContent", "900", "580", "9.0.115", "js/expressInstall.swf", flashvars, params, attributes);
</script>
I've found stuff about including links to JS files but nothing on actually printing code. The JS code MUST go in the head section of the page, anything else just won't work. The JS is also assembled dynamically from Moodle DB entries so that parameters can be set. In other CMS' this is a fairly simple and common procedure but I can't work out how to do it in Moodle.
BTW, in Moodle 1.9 it was a case of doing:
print_header_simple(format_string($swf->name), '', $navigation, '', $swf_javascript_code, true, update_module_button($cm->id, $course->id, $strswf), navmenu($course, $cm));
Thanks in advance!