Step 3: extend the nodeprofile with further content types (optional)
Last modified: March 28, 2007 - 15:34
If you want to build a nodeprofile, which consists of multiple content types, you should use pageroute to provide a user friendly way for inputting the profile data. So be sure to use step 2b instead of step 2a, before you proceed.
You can extend your nodeprofile with multiple content types. You can restrict the maximum number of nodes per user of the further content types to any value or also to 1 as it is the case for the nodeprofile content type.
- To extend your nodeprofile with another content type first create your new content type and set the maximum population in your content type settings located at "admin/content/types".
- Then go to the nodefamily admin page located at "admin/content/nodefamily". Let's assume your nodeprofile's content type is called "profile" and your new one is called "personal data". Then create a new relation with parent type "profile" and child type "personal data". All possible further content types which extend this nodeprofile should all have the nodeprofile's content type "profile" as parent type.
- Then we have to adapt our pageroute. Edit your nodeprofile's pageroute and add a new page. If you have restricted your new content type to a maximum node population of 1, use the lonely node management page type. Otherwise use the node management page type, which lets your users create as much nodes of this type as you have configured as maximum population. The node management page will provide a list of already created pages and if users have appropriate permissions, it will also allow them to edit or delete their nodes from inside the pageroute - without falling out of the route.
- Nodefamily will create relations between all the nodes, which belong to the same nodeprofile of one user. So one could say these nodes build a "nodefamily". Per default this relation information won't be used anywhere, however the nodefamily README describes some ways, how one could use them to show data of the child nodes at the parent nodes.
-
Here example, which adapts the nodeprofile display to include the node view of all children nodes:
Create a new theme-template for your nodeprofile's content type, in our example for the content type "profile". More help on this. Then put this snippet inside your theme to just show all nodes of children types:
<?php
$children = nodefamily_relation_load($nid);
foreach ($children as $childnode) {
print node_view($childnode);
}
?>
Another possibility is to use nodefamiliy's views integration to embed a view, that lists all child types of a special type. Just do it the way you prefer. - Another possibility to use the nodefamily relation data is to make some views with it. For this you need the views fusion module. Proceed with step 4 if you are interested in this.
