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

Director addRules and extra params


Go to End


3 Posts   3345 Views

Avatar
Martijn

Community Member, 271 Posts

12 May 2010 at 7:00am

How should I construct Director:addRules(); like :

Director::addRules(10, array(
	'/$Action/$ID/$OtherID/$Region/$Country/$City' => 'SearchPage_Controller',
));

So I can use (also with nested urls enabled):

http://www.domain.com/home/{$someURLSegment}/{$someAction}/id/otherid/region/country/city/

When I add the above rules I get the error:

[User Warning] popCurrent called on ModelAsController controller, but it wasn't at the top of the stack

Avatar
moloko_man

Community Member, 72 Posts

17 August 2011 at 5:03pm

I realize this is an old post, but were you able to figure this out?

I have a similar set up, where 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.

I get the same error as you did, and I've tried:

Director::addRules(100, array(
	'$Controller//$Action/$ID/$OtherID/$ItemID' => '*'
));

and
Director::addRules(100, array(
	'/$Action/$ID/$OtherID/$ItemID' => 'MyPage_Controller'
));

Avatar
johnmblack

Community Member, 62 Posts

25 October 2011 at 10:40am

Edited: 25/10/2011 10:42am

Do any of the ideas at http://www.silverstripe.org/general-questions/show/16057 answer your question?