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

Resource Holder?


Reply

6 Posts   667 Views

Avatar
Matty Balaam

8 July 2010 at 2:32am (Last edited: 8 July 2010 2:37am), Community Member, 69 Posts

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

Avatar
Matty Balaam

8 July 2010 at 3:52am Community Member, 69 Posts

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.

Avatar
UncleCheese

8 July 2010 at 4:43am 4085 Posts

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

Avatar
Matty Balaam

9 July 2010 at 2:37am (Last edited: 9 July 2010 2:48am), Community Member, 69 Posts

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

Avatar
Matty Balaam

9 July 2010 at 3:23am Community Member, 69 Posts

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.

Avatar
Matty Balaam

9 July 2010 at 4:20am Community Member, 69 Posts

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!