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.

General Questions /

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

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

SS3 urlParam change question


Reply


6 Posts   979 Views

Avatar
merrick_sd

Community Member, 97 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, 604 Posts

5 December 2012 at 12:13pm

Still the same.

http://api.silverstripe.org/3.0/framework/control/Director.html#methodurlParam

Avatar
merrick_sd

Community Member, 97 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, 604 Posts

5 December 2012 at 2:13pm

Sorry, missed that dep note.

Try:

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

Avatar
simon_w

Forum Moderator, 474 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, 97 Posts

6 December 2012 at 12:36am

many thanks

Both of those worked for me

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