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.

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

Determine Subsite in Page

Go to End

2 Posts   613 Views


Community Member, 72 Posts

25 April 2012 at 7:15pm

Hey guys,

So, I'm using a controller to provide services to some Ajax based pages. I'm also using subsites. What I'd like to do is to allow each site to know what subsite its in, so it can make some adjustments.

So, question; is there a way, within a controller, to determine what subsite is currently being served?

Thanks in advance,


Community Member, 72 Posts

26 April 2012 at 9:53am

Figured it out. For those of you who have the same requirement, just do:-


Then, you can, perhaps, differentiate using

$site = Subsite::currentSubsite();
$title = $site->Title;