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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How to use jquery in aa template


Go to End


2 Posts   881 Views

Avatar
dvriens

Community Member, 1 Post

25 November 2013 at 5:18am

Hi everyone,

I'm with this beautifull cms and my new website is starting good.
But in each project there are some problems as i has in this one.

My problem is, is that i use some jquery code in my template files. But after uploading they jquery files don't work.
So i read along here and a couple of sollutions. The first one is to add the files in the core file with the Requirements::javascript("mysite/jqueryddsmoothmenu.js") in the Page.ss in the mysite folder, but this is not working. After this i read somewere on this board that you can load your files directly in your template by using the command <script src="/themes/oil/js/ddsmoothmenu.js"></script> in your template file but this is also not working for me.

The jquery script i use is ddsmoothmenu.js as a virtical menu, in my normal html/css file this works great but now i'm implemting this thema in this cms it's not working anymore.

Please help me what is the right direction to add jquery in my template?

Have a nice day,
A happy new member

Danny Vriens

Avatar
Willr

Forum Moderator, 5523 Posts

28 November 2013 at 10:46pm

Documentation for how to include requirements is listed http://doc.silverstripe.org/framework/en/reference/requirements

The best way is in your Page.php file, inside the init function in your page controller, declare your requirements