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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

url_handlers and action specific templates

Go to End

2 Posts   2328 Views


Community Member, 51 Posts

9 July 2010 at 8:22pm


I'm using SS.2.4.

I want an action called new. But since that is a reservered word I can't make a function called new(). So I've made a url_handler to handle that

public static $url_handlers = array(
        'new' => 'customnew'

My template is called: - and in order to have a specific template for this action I have tried making and
When accessing the url /Mypage/new none of the templates gets loaded. The only way I can load an action specific template is by calling /Mypage/customnew.

Anyone knows how to fix this? I suppose I could render the page with a specific template, but thats not preferable.


Terrence Wood

Community Member, 1 Post

12 July 2010 at 4:30pm

Edited: 12/07/2010 4:30pm

To use a template that doesn't match your ClassName you will need to load your template:

class MyPage_controller extends Page_Controller {
    function customnew() {
        $data = DataObject::get('CustomNew'); 
        return $this->customise($data)->renderWith(array('customnew','Page'));