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

$ThemeDir doesn't work in javascript require


Go to End


2 Posts   3575 Views

Avatar
thany

Community Member, 6 Posts

25 January 2014 at 3:25am

Edited: 25/01/2014 3:25am

I have this code:

<% require javascript("$themeDir/javascript/bl.js") %>

Doesn't work. Nothing gets included.

If I replace the $themeDir by the actual themedir, e.g. "themes/themename", then it does work. This also works:

<script src="$ThemeDir/javascript/bl.js"></script>

Why not in a require?

Avatar
androwan

Community Member, 1 Post

21 October 2015 at 8:55pm

It's because of the "$Theme..." and not "$theme..." ?