Jump to:

21294 Posts in 5734 Topics by 2602 members

General Questions

SilverStripe Forums » General Questions » How to call or point to the 'current theme' in PHP files?

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

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 296 Views
  • neilcreagh
    Avatar
    Community Member
    64 Posts

    How to call or point to the 'current theme' in PHP files? Link to this post

    quick question: Does anyone know how you can call the 'current' theme in the PHP code - I'm looking for the equivalent of $ThemeDir used on the templates, but for use on the php code files. Something like $this->Theme()?

    eg. instead of

    static $icon = "themes/FuelCMS/images/treeicons/folderauto";


    it would be something like

    static $icon = "themes/".$this->Theme."FuelCMS/images/treeicons/folderauto";

  • swaiba
    Avatar
    Forum Moderator
    1675 Posts

    Re: How to call or point to the 'current theme' in PHP files? Link to this post

    SSViewer::current_theme()

  • DesignerX.com.au
    Avatar
    Community Member
    100 Posts

    Re: How to call or point to the 'current theme' in PHP files? Link to this post

    Hi, trying this in SS3.0.3 & I get the wrong theme. I get the theme set in _config.php which is only the default theme not the current. removing SSViewer::set_theme('simple'); will cause SSViewer::current_theme() to return nothing !
    is this a bug or has it changed in SS3 ?
    Thanks

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