Skip to main content

Drupal Family History Project - People

Intro

Tagging items to people and browsing items related to people were first implemented using taxonomy and later changed to nodereference.
Current implementation with node reference
Reason for updating method

I first used taxonomy instead of node reference. My thought was that an item should be tagged according to person, type, etc, so taxonomy seemed the natural choice. I could then make views to pull all items tagged to a person, or all items of type “postcard”, etc. Then I realized I needed a node for a person so that I could easily add a description for each, allow comments on a person rather than just the item, and the ability to add fields to a person like date of birth, etc.

So I created a node type of person while keeping vocabulary of type person. If I added a new person, I added their name to taxonomy, noted the term id, then created a node for them and referenced the appropriate view.

However this seemed duplicative. I thought I should be able to “tag” an item directly to a person node without going through taxonomy.
Approach

So the set up is to add node reference fields to family history person and family history photo content types, and create views using node reference to pull up all items tagged to a person. These views would still need to be embedded in the person node.
Node reference views and relationship

Setting up the view was a little tricky. For photos, for ex, first filter by node published + node type = photo. Then use fields to show a small thumbnail linked to node. So the view is showing all photos. To filter to be only those photos with node reference, my first thought was a filter of some sort, or arguments. However, that wasn't it. Instead, use relationships. Add relationship, then choose content to find the cck field used for node reference, and then choose the cck view. The choose require. The view should now show only items that have a node reference.

To show only the items about a particular person, use arguments. Add argument, node, node id. Then enter the node id of the person you're filtering on and the view should show only items that have a node reference field that uses that node id.

Problems. I encountered two problems. First, initially the view only showed one item (first photo) and then showed duplicates (each item was shown twice). In addition, I had chosen grid, but the items were displaying in a list. I switched back and forth between different styles. I'm not sure what I did, but it reset itself and used the proper grid with no duplications.
First implemention with taxonomy

Taxonomy. There is a taxonomy vocabulary “fh_people”, a controlled vocabulary of names that fh content items can be tagged to.

Nodes. There is a content type “fhv_person”.

Views. There is a view that queries fh_items for fh_people taxonomy terms. These views are then embedded in the person node using view reference or view field.

Views/CCK. The fh_person node includes a cck field that displays the view in a node. So the node for a particular person flows into it a view of fh items tagged to that person.

In addition, the fh_ person node contains other cck fields including date fields for birth (and death) and could be expanded to include node reference fields for spouse and children, etc.
Naming conventions

Naming conventions for people

*
fh_item. This is the node for most family history items.
*
fh_photo. This is the node for family history photos.
*
fh_person. This is the node for people.
*
fhv_peoplephotos_noderef. This is the current view for querying fh photos tagged to a node reference. Path is familyhistory/photos/byperson/%1.
*
fhv_peopleitems_noderef. This is the current view for querying fh items tagged to a node reference. Path is familyhistory/photos/byperson/%1.
*
fhv_by_person. This is the old view for querying fh_items by person. Path is /familyhistory/fhbyp/%1.
*
/familyhistory/people pathauto path for fh_person nodes.
*
fhv_people. This is the view for querying fh_people nodes. Path is /familyhistory/peoplelist

Other

Menu. There is “People” as a menu item under Family History. The People menu item is a view that queries for the fh_person node. So the view generates a list of people, linking to their node.

Issues. If I have a pathautho /familyhistory/people/%1 as the url for nodes themselves, if I create a separate query /familyhistory/people to list nodes, it comes up blank. so I've used /familyhistory/peoplelist for that query.

tag_drupal

Logged in as: Jeff McCoy
dfhp-people.txt · Last modified: 2008/12/22 22:19 by jeff

Recent changes RSS feed