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.

All other Modules /

Discuss all other Modules here.

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

subsite specific template methods


Go to End


2 Posts   1084 Views

Avatar
zenmonkey

Community Member, 545 Posts

11 January 2011 at 7:46am

I'm just wondering if there are any methods in subsite accessible from the template. I'd like to show slightly different information in my page footer on my subsites than my main site. So an <% if Subsite %> type methods would be ideal

Thanks

Avatar
dompie

Community Member, 88 Posts

12 January 2011 at 5:33am

I have added add a Method to my Page_Controller as follows:

	public function IsOnSubsite(){
		return is_object(Subsite::currentSubsite())?1:0;
	}

Some of the Subsite variables/methods you can also access with $Subsite.currentSubsiteID, but I don't know which and how reliable they are.