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:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

urlParams - more info


Go to End


2 Posts   1842 Views

Avatar
Ryan M.

Community Member, 309 Posts

20 December 2009 at 11:24am

I see this bit of code being used in some places: $this->urlParams['']. I've seen an ID or an Action being passed with this, and you can pass something off to this by appending it to the url, such as: http://domain.com/Page/actionname. My questions are, how deep can this go? How does it know what I'm passing is an ID or some kind of action, or something else? Does it matter if I reverse the order up, like... domain.com/Page/actionname/ID or domain.com/Page/ID/actionname

Just looking for some light to be shed on this particular thing.

Avatar
bummzack

Community Member, 904 Posts

20 December 2009 at 12:50pm

Edited: 20/12/2009 12:52pm

It's always Action/ID/OtherID.
This is defined as a "rewrite-rule" in sapphire/_config.php

Director::addRules(1, array(
	'$URLSegment//$Action/$ID/$OtherID' => 'ModelAsController',
));

You can create your own rules if you need other syntax or more parameters.
Update: Action usually refers to a method on the controller. Eg. somepage/test calls the "test" method on the somepage controller