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.

General Questions /

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

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

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


Go to End


3 Posts   4559 Views

Avatar
neilcreagh

Community Member, 136 Posts

27 January 2012 at 4:06am

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

Avatar
swaiba

Forum Moderator, 1899 Posts

27 January 2012 at 4:27am

SSViewer::current_theme()

Avatar
DesignerX.com.au

Community Member, 107 Posts

20 March 2013 at 2:05am

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