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

fancybox or shadowbox not showing


11 Posts   8073 Views


6 June 2011 at 11:26pm Community Member, 63 Posts

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!!


7 June 2011 at 12:00am (Last edited: 7 June 2011 12:03am), Community Member, 141 Posts

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 :-)



7 June 2011 at 12:31am Community Member, 63 Posts

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!