I'm working on a site that for a company that has many lines of business in many areas of the world, therefore there is a contact page for each region (see this image for a quick look at an example of a contact page on their site).
The site owner would like to be able to add and remove contacts on a page on the fly, as the division grows. Some pages may have 1 or 2 contacts, but some might have 10+. I've created a CCK content type (see this image for a quick look at the fields), but I'm looking for a way to add additional contacts on the fly rather than creating 10+ contact field-groups on content type admin page.
Any ideas on a good way to do this? is there a module already out there that could help?
Thanks!
Comments
_
Instead of making the contacts fields, why not make them a content type with a nodereference field pointing to the proper node, then use views_attach to display a view of the related contacts on the page. You can also use nodereference_url to allow for easier adding of relevant contacts right to the page (very much as described in the http://www.lullabot.com/articles/photo-galleries-views-attach video, just not with images and galleries).
I must be missing something
Thank you for your reply.
I followed the instructions in the video: created a contact content type, added a nodereference field to that contact content type, and referred the contact to a page on the site. When I view the contact page, the "page reference" field is shown and a user can click on it and visit the referenced page... but when you visit the referenced page the contact doesn't show on it.
Also, the nodereference field doesn't seem to be editable once it's set. If a contact were to move to a different department, we'd need to change this field.
What am I missing? (thank you in advance!)
_
hmm... not sure what the problem could be, i use this method all the time and it works perfectly. Double check that the view (which is supposed to list the contacts on the page) is working properly and the views_attach field shows up on the content type edit form.
As for the non-editable reference, that's the current behavior of the module. I've submitted a patch to 'fix' that behavior: http://drupal.org/node/396818#comment-1949524.
Yes! It worked!
I went back through and watched the video again (and again), and I believe I had missed a step - I needed to have added the Node Content display on my View (image attached for others who may struggle with this) to display the view as part of a node's content.
Then I also had to make sure I had the correct field chosen in the Argument section. In my case "field_page_reference".
So for my site (for anyone who is doing a similar thing):
Gallery = contacts (or Contact Page)
Photo = contact (or Contact)
The resulting view was somewhat hidden on my page, because of the unique styling of the page. But it shows up in the code so I'll just have to CSS it into place!
Thank you so much for the tips. I just had to stick with it and figure it out... like lots of things in Drupal! :)
_
Excellent! Happy to help ;-)