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.

Archive /

Our old forums are still available as a read-only archive.

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

Themes in stable 2.1: where is my css?


Go to End


5 Posts   1864 Views

Avatar
dio5

Community Member, 501 Posts

16 October 2007 at 11:55pm

Edited: 17/10/2007 12:25am

In the stable version of 2.1 I'm not getting my stylesheets to work.
In rc1 all I had to do was setting SSViewer::set_theme('mytheme');
but that doesn't seem to do much anymore... I'm not seeeing any styles attached.

It worked with the default black candy theme, then I changed ssviewer:set_theme in the _config.php file.

Ideas?

Avatar
sidisinsane

2 Posts

20 October 2007 at 4:02am

I am having the exact same issue as dio5.

Avatar
dio5

Community Member, 501 Posts

20 October 2007 at 4:07am

I solved this by manually setting the stylesheet links in the Page.ss file.

Don't know if that's the recommended way though...

Avatar
sidisinsane

2 Posts

20 October 2007 at 4:47am

Edited: 20/10/2007 4:47am

Which one of the several page.ss?
I was trying to check out the paddygreen-theme just for fun and in the end just renamed it to the default theme. Result was a broken layout.
But nevermind, since I'm not to enthusiastic about SilverStripe after all it's not really worth the effort.

Thanks anyway.

Avatar
Willr

Forum Moderator, 5523 Posts

22 October 2007 at 9:48pm

Edited: 22/10/2007 9:48pm

In PaddyGreen we will have to check this out but for your CSS files you should have this in your Page.php (in mysite/code)

function init() {
 parent::init();
 Requirements::themedCSS('layout');
 Requirements::themedCSS('typography');
 Requirements::themedCSS('form');
 Requirements::themedCSS('myuberfancycssfile');
}

Requirements loads CSS files based on what theme you have set. So in your _config.php you will have SSViewer::set_theme('PaddyGreen') and having that init() in your php will automagiclly look for the css files in PaddyGreen/css. Or you can edit the main Page.ss (If using PaddyGreen it will be themes/PaddyGreen/templates/Page.ss) and add the CSS files as per any standard CSS Linking method :D. Why we have requirements for the css is something I dont even know! I personally prefer the second method.. I just like to have full control over them in my templates.