Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » addRules for my module doesn't override the default URL actions

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

Page: 1
Go to End
Author Topic: 877 Views
  • dalesaurus
    Avatar
    Community Member
    283 Posts

    addRules for my module doesn't override the default URL actions Link to this post

    I am trying to change the URL params for a controller I have written. I have successfully done this through the corresponding _config.php:

    Director::addRules(50, array(
                            MyCustom_Controller::URLSegment . '//$Action1/$Input1/$Action2/$Input2/$Action3/$Input3/$Action4/$Input4' => 'MyCustom_Controller'
                         )
                   );

    However when I dump $this->URLParams I see that the default URL param scheme of '//$Action/$ID/$Type' is still there in addition to my custom rule:

    http://localhost/activate/sweetaction/asdf/1234/nil/0987/zxcv/

    array
    'Action1' => string 'sweetaction' (length=7)
    'Input1' => string 'asdf' (length=4)
    'Action2' => string '1234' (length=4)
    'Input2' => string 'nil' (length=3)
    'Action3' => string '0987' (length=4)
    'Input3' => string 'zxcv' (length=4)
    'Action4' => null
    'Input4' => null
    'Action' => string 'sweetaction' (length=7)
    'ID' => string 'asdf' (length=4)
    'OtherID' => string '1234' (length=4)

    Its not a huge deal, but I'm just trying to understand why it is being appended instead of replaced?

    877 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.