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.

Customising the CMS /

A completly different page in CMS


Reply


5 Posts   579 Views

Avatar
Futureweb

Community Member, 233 Posts

28 September 2011 at 11:01pm

Hi,

Using class ModelAdmin one can add a new tab into the CMS to control dataobjects - what I'm wondering if there is a way to add a new tab, which just loads an SS page template - which can then be used to display/work with data in a complete templateled and free way...

this would be great - for creating a kind of dashboard page with various bits of info, and for displaying reports using charts and stats etc etc...

Cheers

Avatar
swaiba

Forum Moderator, 1805 Posts

28 September 2011 at 11:29pm

absolutely - you might add a LiteralField to a new tab... populated with some data put into a template...

function getCMSFields() {
   $fields = parent::getCMSFields();

   $vd = new ViewableData();
   $ad = new ArrayData(array('Info' => DataObject::get('SomeObject'));
   $strSomeHTML = $vd->customise($ad)->renderWith('TemplateName');
   $fields->addFieldToTab('Root.Bookings', new LiteralField('Label', $strSomeHTML));

   return $fields;
}

Avatar
Futureweb

Community Member, 233 Posts

29 September 2011 at 9:58am

Hi Swaiba - thanks for that snippet...

Note: I'm trying too add a tab to the very top of the CMS - along with 'pages' 'files and images' etc...

infact, I've just found:
http://doc.silverstripe.org/sapphire/en/reference/leftandmain?s=extra%252520menu%252520items
which seems to be what I need...

Avatar
swaiba

Forum Moderator, 1805 Posts

29 September 2011 at 9:34pm

Ahhh... Then this may be of interest to you...

http://www.silverstripe.org/dashboard-module/

I've taken this and put graphs with http://chart.apis.google.com into it to make a dashboard for a client

Avatar
Futureweb

Community Member, 233 Posts

29 September 2011 at 11:19pm

that looks like a great module - a great starting point to add more stuff to...

thanks for pointing it out...