21289 Posts in 5733 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » [SOLVED] Requirements::javascript latches on to inline javascript
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 268 Views |
-
[SOLVED] Requirements::javascript latches on to inline javascript

4 March 2012 at 5:20pm
Hi,
I'm using 2.4.6. Normally the javascript appears at the bottom of the document. But I noticed an odd thing with a HTML page that has some inline javascript. The javascript files included via the Requirements::javascript() - called in the Page_Controller::init() - end up inserted just before my last piece of inline javascript. Certainly not what I was expecting. To work around this I have used the flag Requirements::set_write_js_to_body(false) in _config.php to force the javascript to the top. Note: the javascript is being generated inline by a PHP method. Expected behaviour or bug?
Thanks,
J -
Re: [SOLVED] Requirements::javascript latches on to inline javascript

4 March 2012 at 8:43pm
That's expected as there's no way to know if the inline javascript relies on something being included or not.
-
Re: [SOLVED] Requirements::javascript latches on to inline javascript

5 March 2012 at 11:49am
That shows my lack of web dev. experience! Thanks Simon.
| 268 Views | ||
|
Page:
1
|
Go to Top |

