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

Resource Holder?


Go to End
Reply


6 Posts   753 Views

Avatar
Matty Balaam

Community Member, 74 Posts

8 July 2010 at 2:32am

Edited: 08/07/2010 2:37am

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

Community Member, 74 Posts

8 July 2010 at 3:52am

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

Forum Moderator, 4096 Posts

8 July 2010 at 4:43am

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

Avatar
Matty Balaam

Community Member, 74 Posts

9 July 2010 at 2:37am

Edited: 09/07/2010 2:48am

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

Avatar
Matty Balaam

Community Member, 74 Posts

9 July 2010 at 3:23am

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

Community Member, 74 Posts

9 July 2010 at 4:20am

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!