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

css relative path

Go to End

2 Posts   3227 Views


Community Member, 193 Posts

28 August 2012 at 4:14am

Edited: 28/08/2012 4:14am

in my code/Page.php I use
to add css to a page.

html source code shows <link rel="stylesheet" type="text/css" href="" />

silvertstripe replace css name with absolute path.
I need relative path like this

<link rel="stylesheet" type="text/css" href="themes/mytheme/css/layout.css?m=1333695202" />

Is this possible?how?


Community Member, 9 Posts

4 November 2012 at 2:37am

Edited: 04/11/2012 2:38am

That's strange. For me it resolves the relative path when using themedCSS.
Instead of doing this you might want to try something else:

<% require css(themes/mytheme/css/layout.css) %>

This should do the same job as


Or you can try resolving them manually using $ThemeDir.
You can find a more detailed explanation over here.

If this doesn't do the trick I guess it's something in your configuration you'll need to change in order to get the relative urls.