| 1 |
$Id: README.txt,v 1.6 2007/03/15 15:53:00 fago Exp $
|
| 2 |
|
| 3 |
Node Family Module
|
| 4 |
------------------------
|
| 5 |
by Wolfgang Ziegler, nuppla@zites.net
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
Description
|
| 10 |
-----------
|
| 11 |
With this module you can define relations between content types. It
|
| 12 |
automatically creates a relation between all nodes which have been created
|
| 13 |
by the same user and have the defined content types.
|
| 14 |
|
| 15 |
It is a simple node relationship module which doesn't provide any end user
|
| 16 |
interface. Relations are set automatically (based on admin defined content
|
| 17 |
type relations) or programmatically through its API.
|
| 18 |
It also allows to restrict the population of a content type (the number of
|
| 19 |
creatable nodes of a content type per user).
|
| 20 |
|
| 21 |
The module doesn't display related nodes when viewing a node or anything
|
| 22 |
similar. Currently it's up to the user to use the relation, e.g. use it to
|
| 23 |
display related nodes during viewing a node (example provided) or use it for
|
| 24 |
generating views in conjunction with views fusion.
|
| 25 |
|
| 26 |
|
| 27 |
Installation
|
| 28 |
------------
|
| 29 |
Simple copy the files in your drupal modules directory and activate the module.
|
| 30 |
|
| 31 |
|
| 32 |
How to use it
|
| 33 |
-------------
|
| 34 |
Go to 'admin/content/nodefamily' to manually add relations between content types
|
| 35 |
or set relations programmatically through the API.
|
| 36 |
|
| 37 |
|
| 38 |
The module doesn't display related nodes or anything similar when viewing a
|
| 39 |
node. Currently it's up to the user to use the relation, e.g.:
|
| 40 |
|
| 41 |
Short instructions to display child nodes inside a parent node:
|
| 42 |
|
| 43 |
* theme the default display of your parent node type,
|
| 44 |
instructions are available in the handbook: http://drupal.org/node/11816
|
| 45 |
|
| 46 |
* load the children's nodes at the top of your theme:
|
| 47 |
<?php $children = nodefamily_relation_load($nid); ?>
|
| 48 |
|
| 49 |
* get the node views and print them
|
| 50 |
|
| 51 |
e.g. use this to print the teaser of the first child node:
|
| 52 |
<?php print node_view($children[0], TRUE, FALSE, TRUE); ?>
|
| 53 |
|
| 54 |
or this to print the full node view of all children:
|
| 55 |
<?php
|
| 56 |
foreach ($children as $childnode) {
|
| 57 |
print node_view($childnode);
|
| 58 |
}
|
| 59 |
?>
|
| 60 |
|
| 61 |
* The above example would just print all children. If you want to print
|
| 62 |
a child node of a special content type only, you can use the function
|
| 63 |
nodefamily_relation_load_by_type($nid) instead.
|
| 64 |
E.g.:
|
| 65 |
|
| 66 |
<?php $children = nodefamily_relation_load_by_type($nid);
|
| 67 |
if (isset($children['your_content_type'])) {
|
| 68 |
foreach ($children['your_content_type'] as $childnode) {
|
| 69 |
print node_view($childnode);
|
| 70 |
}
|
| 71 |
}
|
| 72 |
?>
|
| 73 |
Replace 'your_content_type' with your machine-readable content-type name!
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
The module also allows to restrict the number of creatable nodes of a content
|
| 79 |
type per user (population).
|
| 80 |
You can find this setting at 'admin/content/types'. It might be useful
|
| 81 |
to set the population to one for a parent content type.
|
| 82 |
|
| 83 |
If the population of a content type is restricted to 1,
|
| 84 |
nodefamily provides a unique URL for adding/editing nodes of this type:
|
| 85 |
|
| 86 |
Go to 'nodefamily/CONTENT_TYPE' for adding/editing your node of the content type.
|
| 87 |
Go to 'nodefamily/CONTENT_TYPE/USER_ID' to edit nodes of this type of other users.
|
| 88 |
|
| 89 |
Replace CONTENT_TYPE with the machine readable content type name.
|
| 90 |
|
| 91 |
|
| 92 |
Pageroute integration
|
| 93 |
---------------------
|
| 94 |
This module offers integration to the pageroute module. It provides two further
|
| 95 |
page types:
|
| 96 |
|
| 97 |
* lonely node management page
|
| 98 |
* lonely node display
|
| 99 |
|
| 100 |
Both page types may be used only with content types which are restricted
|
| 101 |
to a maximum population of one. Then you can use the lonely node management page
|
| 102 |
to add/edit the "lonely node" as it might be useful e.g. for user profiles.
|
| 103 |
|
| 104 |
The lonely node display page can be used to view this lonely node. This might be
|
| 105 |
useful for showing the resulting node. However, keep in mind that
|
| 106 |
there will be a (themeable) "There is no node of this type." message, if there
|
| 107 |
is no node that can be displayed.
|
| 108 |
|
| 109 |
This type are in particular useful, if you want to use pageroute for building
|
| 110 |
nodeprofiles!
|
| 111 |
|
| 112 |
|
| 113 |
Views integration
|
| 114 |
------------------
|
| 115 |
This module offers some basic Views integration. Currently it adds filters for
|
| 116 |
filtering by parent or children node ids which can be restricted to filter only
|
| 117 |
by nodes with a certain content type. This is useful in conjunction with the NOT
|
| 118 |
EQUAL operator, e.g. use NOT EQUAL node id 0 and a special content type to filter
|
| 119 |
by nodes that have children of a special content type.
|
| 120 |
There are also some argument handlers: for filtering by the node id of grandparents,
|
| 121 |
parents, children and grandchildren. Useful for e.g. building a view that lists all
|
| 122 |
children of the node with the argument id.
|
| 123 |
|
| 124 |
For building views that contain data of more related content types or if you need more
|
| 125 |
complex filtering you can use the views fusion module.
|
| 126 |
|
| 127 |
The views fusion module allows you to build tabular views, which list data of several
|
| 128 |
related nodes in one line!
|
| 129 |
E.g. if you use the usernode module together with the nodeprofile module, it allows you
|
| 130 |
to build a user listing which also contains data of your profile node. This is working,
|
| 131 |
because there is a nodefamily relation between this nodes and nodefamily offers views
|
| 132 |
fusion support!
|