Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Themes in stable 2.1: where is my css?

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

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

Page: 1
Go to End
Author Topic: 1519 Views
  • dio5
    Avatar
    Community Member
    501 Posts

    Themes in stable 2.1: where is my css? Link to this post

    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?

  • sidisinsane
    Avatar
    2 Posts

    Re: Themes in stable 2.1: where is my css? Link to this post

    I am having the exact same issue as dio5.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Themes in stable 2.1: where is my css? Link to this post

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

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

  • sidisinsane
    Avatar
    2 Posts

    Re: Themes in stable 2.1: where is my css? Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Themes in stable 2.1: where is my css? Link to this post

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

    1519 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.