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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

***SOLVED***Staff Section without individual pages?


Go to End
Reply

21 Posts   1629 Views

Avatar
ambient

29 September 2011 at 4:49am Community Member, 123 Posts

Hi All,

I'm building a staff section for a website.

The thing is I only need a small amount of info for each staff member.

Image
Title
Name
Department
Phone
Email

It seems excessive and unnecessary to have to create a new page for each member of staff when so little info is involved.

Is there some other way of doing this where I can add a new staff member to the page without creating an extra page for each individual?

Thanks for listening :)

Avatar
swaiba

29 September 2011 at 5:40am Forum Moderator, 1796 Posts

I would agree an entire page is excessive, have you considered StaffPage has_many StaffMember. Where StaffMember is a DataObject, then the getCMSFields would need a tab with a hasmanycomplextablefield controling the relationship.

Avatar
ambient

29 September 2011 at 10:47pm Community Member, 123 Posts

Hi Swaiba,

My silverstripe/php skills aren't the greatest. Are you talking about something like whats done in Tutorial 5 - Dataobject Relationship Management?

I did play around with this a few months back when trying to do something else but ended up dropping it as I couldn't get the ImageField to work in the pop up. If you think that uploading images should work I'll try it again and let you know when/if I run into problems.

Tutorial 5 - Dataobject Relationship Management seems to have a lot more than I'd need. Can you tell me which parts I should concentrate on.

Cheers :)

Avatar
swaiba

29 September 2011 at 11:01pm Forum Moderator, 1796 Posts

My silverstripe/php skills aren't the greatest. Are you talking about something like whats done in Tutorial 5 - Dataobject Relationship Management?

Yes this Project(Page) has_many Student is exactly what I am talking about.

Check this also for more information... http://doc.silverstripe.org/sapphire/en/topics/datamodel
If you have any issues specifically with the tutorial, then please post them as "Issue with tutorial 5" and hopefully they can be solved.

Avatar
ambient

30 September 2011 at 4:44am Community Member, 123 Posts

Okay, I'm making progress now and have it almost working.

The only issue now is When I go to add a new member the pop up won't allow me to choose an image until I have first saved the other details like name, email etc.

Instead of the image upload box I get:
Images can be attached once you have saved the record for the first time.

So I have to save the member, close the pop up, and then edit member to re open the pop up and add the picture.

I have found that it is to do with the DataObject needing an ID before it can create the relation with the image and the ID?

Any ideas on how I can solve this issue?

Avatar
zenmonkey

30 September 2011 at 6:48am Community Member, 528 Posts

Unfortunately, that's normal. Using the DataObjectManager Module will at least let you save the DataObject without closing the popup. Other than you'd need to overload the pop-up and create a new method that would cache the image and create all the data objects sequence since as you guessed you can't associate the image object with the staff dataobject until the staff object as been saved and received an ID

I've toyed with the idea using onAfterWrite and checking for an unset ImageID field to prevent it from running each time the dataobject is saved. Its messy but possible. I've done it with the bulkCSVUploader, but never with a front end form

Avatar
Ryan M.

30 September 2011 at 9:52am Community Member, 309 Posts

You could use Uploadify, which will allow you to upload images before a DataObject is created for the first time. Uploadify holds the image information in temporary space/memory until the object is created, then it adds the file relationship.

Avatar
zenmonkey

30 September 2011 at 9:56am Community Member, 528 Posts

Good to know, UncleCheese hadn't released that module last time I was playing with that kind of functionality. May have to upgrade some sites

Go to Top