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.

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

SS3 urlParam change question


Go to End


6 Posts   1849 Views

Avatar
merrick_sd

Community Member, 99 Posts

5 December 2012 at 3:43am

if i was previously saying

if ( Director::urlParam("OtherID") ) {

what does this become in SS3?

HTTP_Request::??

Avatar
Double-A-Ron

Community Member, 607 Posts

5 December 2012 at 12:13pm

Avatar
merrick_sd

Community Member, 99 Posts

5 December 2012 at 1:28pm

When I use
$MyRequesParamvar = Director::urlParam("OtherID"); in ss2.* works fine.

In silver stripe 3 I get an error saying Director:urlParam is depreciated.

So I'm not sure how I use the http_request ?

what does the above become in Silverstripe 3?

Avatar
Double-A-Ron

Community Member, 607 Posts

5 December 2012 at 2:13pm

Sorry, missed that dep note.

Try:

$this->request->getVar('OtherID');

Avatar
(deleted)

Community Member, 473 Posts

5 December 2012 at 3:11pm

Assuming you're in a controller, it becomes $this->request->param('OtherID'). Otherwise, Controller::curr()->getRequest()->param('OtherID').

Avatar
merrick_sd

Community Member, 99 Posts

6 December 2012 at 12:36am

many thanks

Both of those worked for me

i used $this->request->param('OtherID');