Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Resource Holder?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 660 Views
  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Resource Holder? Link to this post

    I have a portfolio section on my website. At the moment it is very simple: the 'resource' consist of a title, description, an image, and a URL, and they are all shown on the same page.

    How would I go about creating a 'holder' page which displays only the titles and an image of all resources, but then when clicked on, goes to another page with just the details of that dataobject?

    EDIT: found something in the tutorials which will hopefully help http://doc.silverstripe.org/tutorial:2-extending-a-basic-site

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Re: Resource Holder? Link to this post

    I'm not really getting it, I still think I need some help!

    Firstly, can make a 'holder' page in the CMS which will hold all the dataobjects?

    Secondly, how do I then make a separate page to display one selected dataobject when the link is clicked.

    Thanks again.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Resource Holder? Link to this post

    Have you checked out the "code examples" sticky in this forum?

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Re: Resource Holder? Link to this post

    EDIT: Realised I was looking at the wrong example, nothing to see here!

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Re: Resource Holder? Link to this post

    Sorry, I'm still stuck. I've removed all the parts relating to groups in the Resources example you've made with ResourcesOverview, but how do I get the ResourcesOverview page to display? I can only select 'Resource Page' in the CMS and this shows every Resource.

    I removed all this code, should I have kept some in?

       public function Resources()
       {
          $all_resources = new DataObjectSet();
          if($user = Member::currentUser()) {
             if($groups = Member::currentUser()->Groups()) {
                foreach($groups as $group) {
                   if($r = $group->Resources("ResourcePageID = $this->ID AND Global = 0"))
                      $all_resources->merge($r);
                }
             }
          }
          $global_resources = DataObject::get("Resource","ResourcePageID = $this->ID AND Global = 1");
          if($global_resources)
             $all_resources->merge($global_resources);
          $all_resources->removeDuplicates();
          return $all_resources;
       }


    Thank you for your patience.

  • Matty Balaam
    Avatar
    Community Member
    69 Posts

    Re: Resource Holder? Link to this post

    I think I'm going to instead use a Jquery plugin to load everything on one page and then hide and unhide elements, seems much simpler!

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