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 /

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

fancybox or shadowbox not showing

Go to End

11 Posts   9009 Views


Community Member, 63 Posts

6 June 2011 at 11:26pm

hmmm yes that makes sense on a normal html static website but since in silverstripe the JS on my template is described like this:

<% require javascript(mysite/javascript/shadowbox-3.0.3/shadowbox.js) %>

where do I put the init()???

sorry for being so clueless!!


Community Member, 141 Posts

7 June 2011 at 12:00am

Edited: 07/06/2011 12:03am

Hmmm, you could write the code directly to your template beneath your <% require ... %> ...
or you could create a javascript file called "shadowbox_setup.js" in /mysite/javascript, write Shadowbox.init(); to it, and require this file in your template :

<% require javascript(mysite/javascript/shadowbox-3.0.3/shadowbox.js) %> 
<% require javascript(mysite/javascript/shadowbox_setup.js) %>

or you delete these <% require ...%> thingies from the template and add this to the init() method of the Controller class of the Page type:
function init() {
   Requirements::customScript('<script type="text/javascript">Shadowbox.init();</script>');

^^Hope this is somewhat understandable, cause we have a nice party going on and i allready had some beer :-)



Community Member, 63 Posts

7 June 2011 at 12:31am

aaaaaah thank you so much!!! the first method did the trick...however not until after I noticed that I forgot to include the shadowbox.css as that this is solved it finally works!!

thanks so much! You´ve always been a great help (especially when drunk ;-)
have a nice party!


Go to Top