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.

Customising the CMS /

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

How to customise SilverStripe - Newbie??


Go to End


2 Posts   1136 Views

Avatar
Nadz

Community Member, 8 Posts

29 March 2012 at 12:24pm

I am new SS developer and user. The site i am working on has multiple design layouts of same page.
For example, a homepage can be of 3 design layouts, one for a standard user, one for client and one for business user.
Each layout has its 3 to 6 content boxes which are editable by editor, something like this http://www.checkoutapp.com/
All content has to be editable by content authors who are not html savvy.

I dont intend to develop multiple templates for single page.

Can someone please let me know as what is the best approach of developing templates for this kind of site.
Can i have a standard page, say Homepage, with cotent-editable widgets for each boxes??

thanks in advance.
Nadeem

Avatar
novaweb

Community Member, 116 Posts

29 March 2012 at 2:28pm

Hi Nads,

Welcome to the SilverStripe community.

This is not a complete answer, but will get you on the right track. It will be a little bit of a challenge if you are new to SilverStripe, but for someone familiar with it, it could be achieved in under a couple of hours.

1) Create your different Security Groups, in the Security section of your site (Standard, Client, Business) - add appropriate members.
2) Create your main CSS stylesheet in themes/mytheme/css/layout.css - This should hold the div styling, the structure for your page, but no colours or "Group Specific" css.
3) Create your "Group Specific" css files in themes/mytheme/css/ (standardUser.css, clientUser.css, businessUser.css)

I'll assume from here on you want this to be applied to every page type, so we will use Page.php

4) Do this in Page.php Page_Controller class, right at the top: (haven't tested code, but you should understand the logic)

function init() {
	parent::init();
	
	// This part switches the CSS based on the logged in user
	
	if(Member::CurrentUser()->InGroup('Standard')) {
		Requirements::css('themes/mytheme/css/standardUser.css');
	} elseif(Member::CurrentUser()->InGroup('Client')) {
		Requirements::css('themes/mytheme/css/clientUser.css');
	} elseif(Member::CurrentUser()->InGroup('Business')) {
		Requirements::css('themes/mytheme/css/businessUser.css');
	}
}

Cheers,
Nova