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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Creating pages automaticaly from a DataObjectSet with one page per dataObject


Go to End
Reply


10 Posts   2100 Views

Avatar
UncleCheese

Forum Moderator, 4092 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