Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ss2.4 beta, i18n, prototype and jQuery noconflict


Go to End


13 Posts   3539 Views

Avatar
yurigoul

Community Member, 203 Posts

8 February 2010 at 4:22am

Am not sure where to post this, could also post this in the module forum instead, but here I go:

I came to understand that silverstripe 2.4 will say goodbey to prototype and favor jQuery instead. But I have noticed that the beta of 2.4 still uses prototype for i18n. Is this going to change?

If not, this brings me to the following point: If you use i18n you are using prototype and therefor you have to use jQuery noconflict if you also want to use jQuery.

I have noticed that at least one of the modules (the Newsletter module in its latest trunk - could also be the userdefined forms since you need to install that as well) assumes you are not using prototype, and it therefor uses $() instead of jQuery() to start it's magic in the document.ready function for the subscription page. I hope that people are aware of this and offer a way to circumvent this - or that we can stop using prototype all together at some point.

Avatar
bummzack

Community Member, 904 Posts

8 February 2010 at 5:16am

Using jQuery noConflict is not required if you wrap your jQuery code in a Block like this:

;(function($) {
// your jQuery code here.. you can use $
})(jQuery);

This is also covered here: http://doc.silverstripe.org/doku.php?id=jquery

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 10:20am

Upgraded 2.4 alpha to 2.4 beta , and now cannot access cms anymore (mydomain.com/admin).

It is stuck in the SS loading screen.

FF shows in the error console:

$("separator") is null
fixRightWidth()LeftAndMain.js... (line 57)
anonymous()LeftAndMain.js... (line 215)
anonymous()LeftAndMain.js... (line 8)
anonymous()jquery.js... (line 2294)
anonymous()jquery.js... (line 2314)
anonymous()jquery.js... (line 745)
anonymous()jquery.js... (line 2313)
$('separator').style.left = (sep + 2) + 'px';\n

which happens in /cms/javascript/LeftAndMain.js

I see that LeftAndMain.js in 2.4 beta is totally different from 2.4 alpha. Could this be related to yurigoul's point?
(Btw i'm not using translatable for that site, but the newsletter module.)

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 11:52am

Sorry, no, that is a different issue, opened Ticket #5046 for it: /cms/javascript/CMSMain.js has 0 Bytes, and date of 28 Jan 2006 in SilverStripe-v2.4.0-beta1.tar.gz.

Avatar
MateuszU

Community Member, 89 Posts

8 February 2010 at 12:17pm

Edited: 08/02/2010 12:23pm

CMSMain.js has 0 bytes because after one of the refactorizations all the code got removed, so this is more like an artifact. Got some projects running on 2.4, and they have this file empty allright.

Edit: had a look and maybe it is a problem after all, will check after lunch :)

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 12:33pm

The site itself is running after the upgrade from 2.4 alpha to beta, it's just the cms which does not load and that seems to to be due to javascript errors (this $("separator") is null ) in LeftAndMain.js. Of course that might have a different reason, but that empty file was just too obviously looking like an error ...

Avatar
MateuszU

Community Member, 89 Posts

8 February 2010 at 1:03pm

I think it's fine, there must be another reason for your problems. I've just installed clean branches/2.4 and CMSMain.js *is* empty. It gets populated on 2.5 though. Maybe there are some modules that are causing trouble? Or maybe some custom cms modifications you have? (since the clean install performs fine...)

Avatar
Kalileo

Community Member, 127 Posts

8 February 2010 at 1:42pm

Thanks for this feedback, mateuzs, very helpful, indeed.

I have not touched the cms code, so it's not that, however it was an upgrade of a 2.4 alpha (not a fresh install of the beta), plus a bunch of modules and widgets, so it could be one of that. I'll do a clean install and add the modules and my stuff one by one, until the error appears.

Go to Top