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 /

LeftAndMain - actions cuasing site error


Reply


500 Views

Avatar
Futureweb

Community Member, 233 Posts

29 September 2011 at 2:21pm

Hello,

So, I'm extending the leftandmain class to make a custom CMS section, and running into one problem:

class MyAdmin extends LeftAndMain {
   static $allowed_actions = array ('show');
}

in the left side i have links to 'admin/myadmin/show/$id', and i have enabled the show action.

if i created a function:

function show() {
   $ID = Director::$this->request->param('ID');
   return "hello i'm object id $ID";
}

when i add in the following function it works, but the screen is blank apart from the line - as expected.
however, if i don't include this 'show' function silverstripe gives me a server error "Sorry, there was a problem with handling your request."...
in the error log it's saying 'singleton() Called without a class'

so i guess - do i need the 'show' function? how can i just pass back returned data to the myadmin/ page - as i would outside of the CMS...

thanks