+* Implementation of hook_insert().
+*/
+function mkdru_insert($node) {
+ db_query("INSERT INTO {mkdru} (nid, vid, pz2_path) VALUES (%d, %d, '%s')",
+ $node->nid, $node->vid, $node->pz2_path);
+}
+
+/**
+* Implementation of hook_update().
+*/
+function mkdru_update($node) {
+ if ($node->revision) {
+ // New revision; treat it as a new record.
+ mkdru_insert($node);
+ }
+ else {
+ db_query("UPDATE {mkdru} SET pz2_path = '%s' WHERE vid = '%d'", $node->pz2_path, $node->vid);
+ }
+}
+
+/**
+ * Implementation of hook_nodeapi().
+ *
+ * When a node revision is deleted, we need to remove the corresponding record
+ * from our table. The only way to handle revision deletion is by implementing
+ * hook_nodeapi().
+ */
+function node_example_nodeapi(&$node, $op, $teaser, $page) {
+ switch ($op) {
+ case 'delete revision':
+ // Notice that we're matching a single revision based on the node's vid.
+ db_query('DELETE FROM {mkdru} WHERE vid = %d', $node->vid);
+ break;
+ }
+}
+
+/**
+ * Implementation of hook_delete().
+ *
+ * When a node is deleted, we need to remove all related records from our table.
+ */
+function node_example_delete($node) {
+ // Deleting by nid covers all revisions.
+ db_query('DELETE FROM {mkdru} WHERE nid = %d', $node->nid);
+}
+
+
+
+// Node rendering
+/**
+* Implementation of hook_load()
+*/
+function mkdru_load($node) {
+ return db_fetch_object(db_query('SELECT pz2_path FROM {mkdru} WHERE vid = %d', $node->vid));
+}
+
+/**