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.

Themes /

Discuss SilverStripe Themes.

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

Fancy Box and site-search form in conflict


Go to End


4 Posts   3097 Views

Avatar
Optic Blaze

Community Member, 190 Posts

22 September 2010 at 8:12am

Hello. I have added fancybox to my site. As soon as i enable site-search, fancybox stops working. I am using ss2.4.1 and fancybox jquery.fancybox-1.3.1

As far as i can tell, it seems that the code for the site-search gets added to the bottom of the page, just before the body tag closes. Shouldnt this code be in the <head> tag of the page.

I am using the "//Enable search form //FulltextSearchable::enable();" command in the _config.php file to activate the site-search.

Any help will be appreciated.

Avatar
Willr

Forum Moderator, 5523 Posts

22 September 2010 at 7:28pm

Look at your app for a couple of things which could be causing this.

* A lot of SilverStripe modules and core uses jQuery so to avoid including jQuery twice the best line to use to add jQuery is

<% require javascript(sapphire/thirdparty/jquery/jquery.js) %>

* Make sure your code uses closures to prevent it from conflicting. See the template for it at http://doc.silverstripe.org/javascript#custom_jquery_code.

* Ideally don't include raw script tags in templates for things which rely on other files. Best to make them a file and use <% require javascript(...) %> to add it to the requirements log.

As far as i can tell, it seems that the code for the site-search gets added to the bottom of the page, just before the body tag closes. Shouldnt this code be in the <head> tag of the page.

SS loads all its required files at the bottom of the page for performance reasons. See http://developer.yahoo.com/performance/rules.html for more information on that.

Avatar
patattrash

Community Member, 16 Posts

14 October 2010 at 6:02am

Same problem here except I am using jFlow Plus for an image rotator. I have all of my js enclosed and am calling the jQuery file as you mentioned. I don't see errors in Firebug either. Any ideas?

Avatar
patattrash

Community Member, 16 Posts

14 October 2010 at 6:06am

Woot woot! Idiot alert here. I had an errant ; in the closure that caused it to stop working. All's good now. Much thanks for the help.