1
votes

I created the controller ./mysite/code/FileManager.php with the following code...

class FileManager_Controller extends Controller
{
    public function upload()
    {
        echo 'It works!!';
    }
}

This works fine when I type http://example.com/filemanager/upload.

And I created the template file themes/simple/templates/FileManager.ss. I want to write the HTML for upload here and it should reflect when I type http://example.com/filemanager/upload. How to do this? Thank you.

2

2 Answers

1
votes

Because you're using a straight controller to handle the request, the system doesn't know what you want to render or how. When using the CMS and rendering a Page this is usually taken care of for you.

So you have to tell it what to render and how. In it's simplest form this would look something like:

class FileManager_Controller extends Controller
{
    public function upload()
    {
        return $this->renderWith('FileManager');
    }
}

That will render your FileManager_Controller class with the FileManager.ss template.

1
votes

'upload' is an action in SilverStripe - have you tried creating a FileManager_upload.ss file ?