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

LeftAndMain - actions cuasing site error


Go to End


923 Views

Avatar
JonShutt

Community Member, 244 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