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.

General Questions

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

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

Requirements not loading


Reply

4 Posts   575 Views

Avatar
voodoochile

17 October 2011 at 10:52pm Community Member, 52 Posts

ok so i have been scratching my head over this for awhile, i am trying to get colorbox working within a dataobject and i'm really not sure whats going wrong it all works up to the point where i click on the image to view it.
so far the only reason i can see for it not working is that 2 of the required javascript and css files for colorbox; are not loading the 3rd and a custom script are loading?
i have checked the paths etc and these are all correct, if i type in the full path eg Http://blah/blahblah/etc the files load but don't work.

Avatar
FullWebService

18 October 2011 at 2:15am Community Member, 38 Posts

I use colorbox a lot and have no problems with it.

I load the files with:

   
Requirements::themedCSS('colorbox');
Requirements::javascript('themes/'.SSViewer::current_theme().'/js/jquery.colorbox-min.js');

The colorbox css file is in /themes/theme_name/css/ and the js file in /themes/theme_name/js/.

The image files I put in /themes/theme_name/images/colorbox/.

Then I search and replace url(images/ with url(../images/colorbox/ in the colorbox.css file.

Avatar
Sticks

18 October 2011 at 1:14pm Community Member, 29 Posts

I had a similar problem with Colorbox. The solution for me was to add a no conflict line at the beginning of the Colorbox js file:

jQ = jQuery.noConflict();

I then changed all the $ to jQ (although not the $ in the regular expressions) and it worked fine after that. You need to make sure you call jQuery before Colorbox as well in your _config.php.

Avatar
voodoochile

18 October 2011 at 3:34pm Community Member, 52 Posts

Hi and Thanks for the replies

Fullwebservice - your reply helped a great deal, thanks i finaly got it working using your solution after messing around a little.
after i got the files loading using your method it still wasn't working a little more searching and i found i also had the requirements loading in the wrong order ... overall i am stoked to get this going although i am wanting to make this into a module so i will have to play around a little more, at least now i know it works as i had envisiged .. thank you.

Sticks - thank you for your reply, i did see a thread ( may have been yours) regarding this when i was trouble shooting after i got the Requirements to load i thought too this may have been an issue as it turns out i just needed to have the requirements load in the correct order, i still have the $ in the code and it works fine.

so once again thank you for your help