21294 Posts in 5734 Topics by 2602 members
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|Go to End|
31 March 2011 at 8:54pm
as much as i love ss for its immense possibilities, its ease of use (even if i hate php - its such a ugly language...) as much i hate how it handles requirements.
i was at this point like 2 years ago and since then nothing changed.
can any on tell me, how and why a linked js file in a include (.ss) can be above requirements that are defined inside the head tag???
that's just plain stupid.
i understand that there can be no absolute solution to that. but at least respect that js/css files that are defined as required in the head are please, please be included on top of the other files?
is that really too much asked for??
so, now that i cooled down, is there now a solution to this? did i miss something?
any help appreciated...
31 March 2011 at 10:20pm
That is the expected behaviour, as it's impossible to know if something included using Requirements is needed for something in those hardcoded blocks to work, they're put above it, just in case.
You can use Requirements::insertHeadTags('<script src="blah.js"></script>'); in the init() method in your Controller subclass to ensure that something goes in the head and doesn't cause other included things to be put before it (it adds right before </head>).
31 March 2011 at 10:38pm
i was just about to clarify my post, as it is indeed confusing.
it's ok to add all js to the end of the html document. i agree with that.
and of course (as i mentioned) ss can not know what order the requirements in some include files should have.
it should be quite obvious, that linked files in the Page.ss or Page.php (or the equivalent - the top most page subclassing Page.php or SiteTree.php)
should be placed on top of others. and all js defined in a include - way down in hirarchy - should be placed belowe.
am i wrong? i can't see a case where this order wouldn't work.
pls tell me your thoughts on this.
|Go to Top|