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 /

url_handlers problem


Reply


3 Posts   2221 Views

Avatar
joern

Community Member, 28 Posts

16 February 2010 at 8:50am

Edited: 05/05/2010 7:36pm

Hi,
I play something with the url_handlers and I have a problem…
I get the following error when I test my URLs:

[User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack
GET /explore/record-name/comments/add/12/?flush=1
Line 454 in /sapphire/core/control/Controller.php

/explore/record-name/ -> class Record extends Page

in Record_Controller:

public static $url_handlers = array(
    ''   => 'index' // works
   ,'comments' => 'showComments' // works
   ,'POST comments/$Action' => 'commentAction'
   ,'comments/$Action/$ID' => 'editComment'
   );

I try to access the following urls:
/explore/record-name/comments => with index
/explore/record-name/comments/add => commentAction
/explore/record-name/comments/edit/$ID => editComment
/explore/record-name/comments/delete/$ID => editComment

I hope you can help me…
Jörn

I have almost forgotten. I use silverstripe 2.4 beta

Avatar
Wade

Community Member, 6 Posts

14 June 2011 at 3:37am

Don't know if you still need help with this but I had the same problem with my url handlers.

I finally found that i had forgotten to add the methods to the allowed actions list.

Avatar
moloko_man

Community Member, 72 Posts

17 August 2011 at 5:33pm

Not sure if this is the same problem as I'm having, but I'm trying to do a similar thing with the URL. However, I want to have domain.com/myPage/show/ID/otherID/itemID
it could go one or two more deeper, but I'm just trying to get the $ItemID part figured out.

@Wade, how did you end up using the allowed actions list?

Thanks.