This is a module which might be regarded as a bit odd as it specifically avoids displaying any of the site/theme stuff. I use a Drupal based site as a collection point for a lot of notes and writing which I do, with mailhandler pulling in emails which I send using a Nokia Communicator. As I travel a lot, this is a great way for me to keep all my writing in one place. I wrote this module as a way to extract ALL nodes form the site in a form which can be directly put into a word processor or saved as a PDF document. I'm not a programmer, so it's probably very rough, but I offer it here just in case anyone else is looking for something similar.
# Module to display all the nodes in the site,
# Standard module help function - how it appears in admin/modules
function everything_help($section) {
switch($section) {
case "admin/system/modules#name":
$output = "everything";
break;
case "admin/system/modules#description":
$output = "Display all the nodes in the system, in a form suitable for printing or moving to a word processor or PDF file.";
break;
default:
$output = "";
break;
}
return $output;
}
# Standard module description function
function everything_system($field){
$system["name"] = t("Everything");
$system["description"] = t("Displays all the nodes in the system");
return $system[$field];
}
# Link the function into the system
function everything_link($type, $node=0) {
if (($type == "system")) {
// URL, page title, func called for page content, arg, 1 = don't disp menu
menu("everything", t("Everything"), "everything_all", 1, 0);
}
}
function everything_settings() {
$output = form_select(t("Body font"), "everything_bfont", variable_get("everything_bfont", "Arial, Verdana, Sans-Serif"),drupal_map_assoc(array("Arial, Verdana, Sans-Serif", "Couier New, Courier")), t("Enter name of the font you want to use"));
$output .= form_select(t("Body font size"), "everything_bfontsize", variable_get("everything_bfontsize", "4"), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7)), t("Enter font size, between 1 and 7, 3 is normal"));
$output .= form_select(t("Title font size"), "everything_tfontsize", variable_get("everything_tfontsize", "6"), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7)), t("Enter font size, between 1 and 7, 3 is normal body text"));
return $output;
}
# The everything function which selects and displays the nodes
function everything_all() {
$tfontstr = "<font face=\"".variable_get("everything_bfont", 0)."\" size=\"".variable_get("everything_tfontsize", 0)."\">";
$bfontstr = "<font face=\"".variable_get("everything_bfont", 0)."\" size=\"".variable_get("everything_bfontsize", 0)."\">";
$efontstr = "</font>";
$page_content = '';
$query = "SELECT nid, type FROM {node} WHERE status = 1 ORDER BY nid";
$result = db_query($query);
while ($node = db_fetch_object($result)) {
#$page_content .= node_view(node_load(array('nid' => $node->nid, 'type' => $node->type)), 0);
$node = node_load(array('nid' => $node->nid));
$title = check_output($node->title);
$body = check_output($node->body);
$page_content .= "<b>".$tfontstr.$title.$efontstr."</b><br><br>".$bfontstr.$body.$efontstr."<br><br>";
}
#print theme("page", $page_content);
print $page_content;
}