Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObjectManager Code Examples

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11
Go to End
Author Topic: 20928 Views
  • stevanovich
    Avatar
    Community Member
    60 Posts

    Re: DataObjectManager Code Examples Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    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.

  • vancouverWill
    Avatar
    Community Member
    121 Posts

    Re: DataObjectManager Code Examples Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    Post your code?

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    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)

  • vancouverWill
    Avatar
    Community Member
    121 Posts

    Re: DataObjectManager Code Examples Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObjectManager Code Examples Link to this post

    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!

    20928 Views
Page: 1 2 3 4 5 6 7 8 9 10 11
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.