Avoiding duplicate book pages
m_freeman2004 - March 2, 2005 - 09:23
Hi,
I have two books and I need to publish the SAME article in BOTH of them. They are two distinct publications (newspapers actually) but somethimes they re-print articles from each other's publications.
Is there a way to publish the article in the first book and then just create a book page that links to the first one? I want to avoid duplicating content in the database.
Any ideas?
Marcus.

How to embed content from one node in another
From http://drupal.org/node/57090#comment-192551
This will mirror the content of the source node and avoid having to store the same information in your database twice.
How to grab just the body of the node
After actually using this solution I discovered that it loaded the whole node including the title and "submitted by" info which duplicated information from the node I was embedding the content into, which wasn't was I was looking for. So I came up with this code which only embeds the body of the latest revision of the node:
<?php$node_body = db_fetch_array(db_query(SELECT r.body FROM node n INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.nid =nid));
echo $node_body[body];
?>
where nid (at the end of the query) is the id of the node you're taking the body from.
I know this is rough, so I'd welcome any feedback on how to clean it up and make it better.
Node's body
Try this:
<?php$node = node_load(nid);
echo $node->body;
?>
To preview other elements of a node, try this:
<?phpecho '<pre>';
print_r(node_load(nid));
echo '</pre>';
?>