Jump to:

23007 Posts in 11866 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » Director::addRules() mystery

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: 638 Views
  • aragonne
    Avatar
    Community Member
    26 Posts

    Director::addRules() mystery Link to this post

    Hi there,

    I have the following Director rule defined in my module's _config.php:

    Director::addRules(101, array(
    'Feed//$Action/$LoginName/$Password/$LastModDate/$OutputType/$DeleteMode' => 'FeedEngine'
    ));

    When I access the url

    http://lto-us:8888/Feed/Go/labcorp/abc123/0/analytes/0

    the module does what it's supposed to, which is great, but then I get the following message at the end:

    I can't handle sub-URLs of a FeedEngine object.

    Anybody know why this is?

    If I remove the double slash (//) from the rule after the 'Feed' url, then I get this message:

    The action 'analytes' does not exist in class FeedEngine

    'analytes' is my $OutputType param so not sure why SS is saying it's the $Action param.

    I'm confused about the use of the double slash. I couldn't find anywhere in the docs or forum what it means, but it seems like the separator between the url and the params.

    thanks!
    Steve

  • aragonne
    Avatar
    Community Member
    26 Posts

    Re: Director::addRules() mystery Link to this post

    After chatting with simon_w (super helpful!) on IRC, we came to the following conclusion:

    1. the single / should be used (double slashes have a different meaning and difficult to explain)
    2. once I replaced the zero valued (0) params in the url with non-zero values, the module runs as it should. No explanation yet on why zeroes might be causing problems, though.

    638 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.