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

DataObjectManager Code Examples


Go to End


84 Posts   40578 Views

Avatar
stevanovich

Community Member, 63 Posts

20 August 2009 at 10:43pm

Hi Uncle Cheese

Am I right in saying the above code works with the existing ResourcePage and Resource files I have setup. I set up new pages MyResourceHolder.php and MyResourceHolder.ss. Use this as an include file in my existing ResourcePage.ss. Am I missing something here.

Steve

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2009 at 1:12am

No, I was just using "MyResourceHolder" as an example name. Use whatever class you were using. You don't need to create a subclass or anything.

Avatar
vancouverWill

Community Member, 121 Posts

21 August 2009 at 6:03am

Maybe I am missing something very obvious but I tried creating the new page type ResouceHolderPage.php and ResourceHolderPage.ss, nothing crashed but the page came up empty. From looking at your post am I right in saying that I should be calling it by the the url /my-resource-holder/category/foo ? I couldn't get that to work either, I am trying to get a a set of data sorted, putting the data in had been straight forward with your module but I'm not sure how to list it on the front end. Ideally I wan to be able to have a list of all the categories and clicking on that will take you to a list of what is in the category, then from there clicking on a title will take you to the object with all the corresponding information about it.

So for example first list could be trains, planes, automobiles. By clicking on automobiles you will get mustang, ferrari and cadillac.

You can then also tag the objects by another list such as ground, air. Clicking on air gets you a list of ...........

Anyway I really appreciate all the help.

Many thanks

Will

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2009 at 6:18am

Post your code?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2009 at 6:20am

I'm working on a project right now that has hierarchical resources by category. Is this what you're looking for?

http://imt.carlinowebdesign.com/resources

(excuse the lame animal kingdom metaphor)

Avatar
vancouverWill

Community Member, 121 Posts

21 August 2009 at 6:52am

Hi Uncle Cheese

Thanks for the really quick reply once again. Basically very similar to what you are doing but I want it so you could get to the end results from different directions. So suppose all were sorted by two and four legged. Then two legged would take you to squirrels(mammals) and I can't think of any two legged reptiles now but perhaps some lizards? Or you could start from the top and go down by animal group i.e.(mammals, birds, reptiles). Then you could also group them up by say skin type i.e. (hairy, no hair, scales, slimey).

So then when you put an animal in you would choose the category then select what animal type, legs, skin type, etc.

Also I have looked around for a while and couldn't find a way anywhere of doing it but is there anyway in SilverStripe to have extended Urls's . i.e. in your case http://imt.carlinowebdesign.com/mammals/dogs/

Thanks again

Will

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2009 at 7:24am

Nested urls are currently not supported in the stable release of Silverstripe. There is a nested URLs branch but it's not part of the official release right now. And, oh yeah, it breaks DOM. :)

If you give me an email addy I can send you that code and you can tinker with it as you see fit.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 August 2009 at 7:54am

Yeah, it's a huge criticism of SS, and they're well aware of the need for it. Like I said, there is a functional branch of SS that uses nested URLs. I don't have any experience with it, but apparently they're going to merge it into the trunk in 2.4. I think.

That said, the URL is set up to take arbitrary parameters using /action/ID/OtherID for your controllers by default, or you can set up your own implementations for URL rules. But the idea of /parent-url-segment/child-url-segment is not native.

Glad you're liking SS. It's definitely a breath of fresh air, especially for a programmer. Doesn't box you in the way Drupal does. I just gives you a framework to use, and you can make what you want with it. I really like their philosophy in that regard. Not to mention it's rigidly MVC, and last time I looked into Drupal, I wanted to bang my head looking at all those print() statements in the "templates". Ugh!

Send you an email. Will remove your last post to keep the spam bots away. Good luck!