This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Everything Module

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;
    }

weblink.module patch - view all weblinks

Just an FYI - there was a Feature request for a feature to the weblink.module - to view all weblinks on one page.

I created a patch for this - details:

http://drupal.org/node/14653#comment-23205

Please note, no pager() support is embedded in this patch - which may be an issue for sites with huge weblinks listings.

For drupal HEAD: Display whether a user is online or not on the user profile page (solution)

Hey everyone,

I heard a few people asking about how to display whether a user is online or not on any user profile display page. Well, here is a version for drupal cvs HEAD (should work with 4.5.2) which allows you to do it!

You can download it from
http://www.jordanwillms.com/index.php?p=27

Cheers!

Using title and description fields from attachment.module with upload.module

I am currently using the upload.module and the attachment.module with a site I am developing. I like the ability to add a title for the "attached file" as found in the attachment module... but other than this, is there any added functionality from using the attachment.module? The reason why I ask: I would like to add attachment titles and descriptions to a flexinode content type called "documents" or "files." Unfortunately, the attachment.module doesn't hook into flexinode at this time, so I can't add it through the flexinode interface.

Custom Module, Block and Profile Information

I've read through most of http://drupaldocs.com and the forums, trying to find an answer for this. I'm hoping I'm just missing and it's something simple.

Wrote a custom node module, widget.module. Users can create a "widget", no problem. Inside widget.module I'm trying to write a block hook that will show when that users page is displayed. I want to show the widgets for that particular user.

Question, within:

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions