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.

Template Questions

Shadowbox, fancybox, thickbox ANYTHING!!!!


6 Posts   2826 Views


6 September 2009 at 7:31am Community Member, 3 Posts

Hi Folks,

I've been converting my company's website over to Silverstripe for the last few weeks.
I've done most of it and the SS system is great, now it's time for me to add some of the extra touches.

One thing we had on the old site is a link that brings up a thickbox that contains a list of files to download.

I can't for the life of me get any modal boxes working with Silverstripe, just can't figure it out so I'm here asking for help!!!

I've tried using the requirements to add the Javascript, added them directly in the templates and several other things after scouring the web for the last few days.

Could someone supply some pointers to how to do this?

I've found postings with init code but I'm unsure of where it's supposed to go (

Just a few pointers as to what code goes where to bring up a modal box would be great from someone!!

Thanks in advance,



6 September 2009 at 5:10pm Forum Moderator, 5511 Posts

I've found postings with init code but I'm unsure of where it's supposed to go

init() is the function that is always called on your controller. So putting that code as your init() in /mysite/code/Page.php in the Page_Controller section then the javascript will be included on every page of your website.

You should be able to use most libraries without a hassle. You might want to check it is not conflicting with any prototype / SilverStripe JS which is included on the page.

For example from one of my projects I used fancy zoom and I included it this way..

// in my mysite/code/page.php file inside the Page_Controller class
function init() {

      // LightBox Code

Also make sure you have FireBug installed as this will make debugging / investigating what is going wrong a heck of alot easier.


7 September 2009 at 1:33am Community Member, 3 Posts

Thanks for the input.

One thing I don't get is that when you put the requirements in there, according to chromes debug tools, it loads the .js stuff at the end of the page meaning that when i try to run the scripts it doesn't work!

Any ideas?


7 September 2009 at 4:48am Community Member, 3 Posts

Well, I got Shadowbox working by linking to the Javascript in the .ss file, not ideal but it works!
Know I just need to figure out how to display another ss page inside the box, at the moment linking to opens in a box but if I try to link to another page on the site it just opens the link like normal!!!



7 September 2009 at 9:45am Forum Moderator, 5511 Posts

it loads the .js stuff at the end of the page

It is good practice to load your js at the bottom of the file. See for more information on why you would do it.

If you want to disable it you can set this in your _config file.



29 September 2009 at 4:30am Community Member, 5 Posts

Hi looks like you now what your doing can you help me i dont now were to start with lightbox2 i use it on my normal site other words not cms and can get it to work fine but having prob here.