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

Extending LeftAndMain 101


Go to End


6 Posts   3097 Views

Avatar
dendeffe

Community Member, 135 Posts

19 May 2011 at 9:30pm

I'm starting to look at extending LeftAndMain and found the documentation here: http://doc.silverstripe.org/sapphire/en/reference/leftandmain

I thought that adding this http://pastie.org/1925934 would at least give me the menu item My Admin in the CMS, but it doesn't even seem to do that. Can soemeone point me in the right direction?

Avatar
swaiba

Forum Moderator, 1899 Posts

19 May 2011 at 9:44pm

I start with the following and build it up step by step...

<?php
class CustomAdmin extends LeftAndMain {
	static $url_segment = 'custadmin';
	static $menu_title = 'Custom';
	static $menu_priority = -2;
}

then also create two templates...
CustomAdmin_left.ss
CustomAdmin_right.ss

Avatar
dendeffe

Community Member, 135 Posts

20 May 2011 at 12:21am

I Feel really stupid now :O

I forgot to add a _config.php to my folder. Thanks for the help.

Avatar
dendeffe

Community Member, 135 Posts

24 May 2011 at 9:05pm

Alright, made something really simple (attached), before diving further into the ins and outs of LeftAndMain. There are probably a lot of things I can do easier with LeftAndMain functionality.

If you have further tips, or see things that are a really bad idea, please let me know.

Attached Files
Avatar
BenWu

Community Member, 97 Posts

19 June 2013 at 1:37am

That's a very good start for SS2.4

What's the simliar for SS3.0? Looks like i am forced to use some kind of form and overwrite the getEditForm function

Avatar
BenWu

Community Member, 97 Posts

21 June 2013 at 11:47am

for SS3.0, i can follow the Dashboard module https://github.com/unclecheese/silverstripe-dashboard to extend LeftANDMain

you have to make a new template

ClassName_Content.ss