3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1929 Views |
-
[SOLVED] Why does calling Requirements::javascript include other core javascript files?

24 January 2009 at 11:45am Last edited: 24 January 2009 5:07pm
Environment: Windows XP SP3 XAMPP, PHP 5.2.8, Apache 2.2.11
SilverStripe version: /branches/2.3In my customised version of mysite/code/Page.php in the init() method, whenever I make a call to Requirements::javascript, the following always end up being included in the outputted HTML.
<script type="text/javascript" src="http://development.surferscentury.com.au/jsparty/behaviour.js?m=1231497686"></script>
<script type="text/javascript" src="http://development.surferscentury.com.au/jsparty/prototype.js?m=1231381869"></script>
<script type="text/javascript" src="http://development.surferscentury.com.au/sapphire/javascript/i18n.js?m=1231381787"></script>
<script type="text/javascript" src="http://development.surferscentury.com.au/sapphire/javascript/lang/en_US.js?m=1231381787"></script>
<script type="text/javascript" src="http://development.surferscentury.com.au/themes/surferscentury/js/jquery-1.3.1.min.js?m=1232688508"></script><script type="text/javascript" src="http://development.surferscentury.com.au/themes/surferscentury/js/swfobject.js?m=1232617897"></script><script type="text/javascript" src="http://development.surferscentury.com.au/jsparty/behaviour.js?m=1231497686"></script><script type="text/javascript" src="http://development.surferscentury.com.au/jsparty/prototype.js?m=1231381869"></script><script type="text/javascript" src="http://development.surferscentury.com.au/sapphire/javascript/i18n.js?m=1231381787"></script><script type="text/javascript" src="http://development.surferscentury.com.au/sapphire/javascript/lang/en_US.js?m=1231381787"></script><script type="text/javascript">//<![CDATA[
Behaviour.register({
'#switchView a' : {
onclick : function() {
var w = window.open(this.href,windowName(this.target));
w.focus();
return false;
}
}
});function windowName(suffix) {
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
return base + suffix;
}
window.name = windowName('site');//]]></script>
Why is this?
Calling Requirements::clear() doesn't work because as soon as I include any javascript via the Requirements:javascript() method, I cannot stop the above output?
How can I stop this happening as I want control over what JavaScript files do and do not display.
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

24 January 2009 at 3:11pm
Do you mean that the <script></script> tags are visible on the screen?
Check whether they are in side the <head></head> section
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

24 January 2009 at 4:33pm
Nivanka - I think you misunderstood the question.
Ryno: These JS files are included in order to enable javascript translation. However, if you don't need any of this, you can manually block each javascript file in your Page_Controller->init() method. Just add something like this to block a javascript file:
Requirements::block('jsparty/behaviour.js');
and so on for each file you don't need.
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

24 January 2009 at 5:06pm
Thanks ajshort, that's exactly what I needed to know!
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

24 January 2009 at 8:20pm
Ah yes Ajshort, I thought something else.
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

27 January 2009 at 3:39pm
I posted on the developer forum about this - I'm not a fan. Even if there is no translatable content on the page, prototype and i18n are included. We should not have to explicitly block javascript files from loading if we're not using them.
It also adds another upgrade step, more baggage to the root page type and so on.
Hamish
-
Re: [SOLVED] Why does calling Requirements::javascript include other core javascript files?

3 March 2009 at 11:54am
Regarding the javascript i18n issue, there's some news here: http://open.silverstripe.com/ticket/3643
| 1929 Views | ||
|
Page:
1
|
Go to Top |





