Jump to:

23355 Posts in 17838 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Determine Subsite in Page

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

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

Page: 1
Go to End
Author Topic: 316 Views
  • Lazarus404
    Avatar
    Community Member
    71 Posts

    Determine Subsite in Page Link to this post

    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,
    Lee

  • Lazarus404
    Avatar
    Community Member
    71 Posts

    Re: Determine Subsite in Page Link to this post

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

    Subsite::currentSubsite();

    Then, you can, perhaps, differentiate using

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

    Lee

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