I have inherited a SilverStripe project that I am cleaning up. Ext JS is used and therefor included in multiple pages. I would like to load the script along with other common requirements in Page.php, as other pages inherit from here. In code I have
class Page_Controller extends ContentController {
function init() {
parent::init();
Requirements::set_write_js_to_body(false);
Requirements::javascript('mysite/javascript/extjs.js');
This produces in <head>
<script type="text/javascript" src="http://localhost/websitename/index.php/mysite/javascript/extjs.js?m=1259182671"></script>
but extjs.js doesn't seem to load, e.g. "flyout" menus depending on it don't appear
If I include extjs.js directly in code with
<script src="$ThemeDir/javascripts/extjs.js" type="text/javascript" charset="utf-8"></script>
this produces in <head>
<script src="/themes/websitename/javascripts/extjs.js" type="text/javascript" charset="utf-8"></script>
which does work.
Though I have a "workaround" I am trying to understand SilverStripe and http/html better. So I would like to understand the problem before deciding how to structure this site. Can someone explain the difference in behavior? Thanks!