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.

Template Questions /

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

fancybox or shadowbox not showing


Go to End


11 Posts   10972 Views

Avatar
tchintchie

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

Avatar
Invader_Zim

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() {
   parent::init();
   Requirements::javascript('mysite/javascript/shadowbox-3.0.3/shadowbox.js');
   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 :-)

Cheers

Avatar
tchintchie

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 well....now that this is solved it finally works!!

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

PROST!

Go to Top