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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Creating pages automaticaly from a DataObjectSet with one page per dataObject


Go to End


10 Posts   3391 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 September 2009 at 1:56am

Whoa, whoa.. no need to edit the core files.

In your _config.php, you can create arbitrary URL rules.

Director::addRules(50, array(
'some-url/$Action/$ID/$OtherID/$Foo/$Bar' => 'MyController'
));

Then the url /some-url/action/123/456/more/stuff

will feed those params to the MyController class.

Avatar
vancouverWill

Community Member, 121 Posts

3 September 2009 at 12:13pm

okay I understand it now I copied the line

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

directly into my _config.php file and that did nothing. After seeing your code I tried it again with the 50 in there and got nothing. Then I realized perhaps it does not work universal and I tried it with the specific URL and the specific controller, then it was golden.

Thanks so much for the help. The forums are amazing with silverstripe.

Go to Top