I am setting up a site which will have stories on the front page and on various other pages. They'll be updated at various times of the day and I'd like to have a block on the front page with a list of updated stories. Sort of like the recently updated comments module. I know of the tracker and trackerlite modules, but they seem to have a separate page, and I want the linsk to all be on the front page.

Comments

BlackSash’s picture

  $result = db_query(db_rewrite_sql("SELECT nid, title FROM {node} WHERE type = %d AND status = 1 ORDER BY changed DESC LIMIT 3"), flexinode-2);

  $output = '<div id="container">';
  $output .= '<ul id="list">';
  while ($node = db_fetch_object($result)) {
  $output .= '<li>'. l($node->title, "node/". $node->nid). '</li>';
    }
  $output .= '</ul>';
  $output .= '</div>';
  return $output;

that should do it for you... change the flexiblock-2 part to your desired node type, and the LIMIT 3 to the desired number of nodes, then add a pinch of CSS and you're rockin'.

I run this on a 4.7 site so I have it in a block in the content area. On 4.6 you'll need for instance the flexiblock module or some manual fiddling with the template file if you want it in the content area. Otherwise just slap this puppy in a block and put it in one of your sidebars.

stevenpatz’s picture

You say I'd need to instance the flexiblock, what does this mean?

pears447’s picture

There are a couple different ways of doing this in the PHP snippets section on drupal.org. See http://drupal.org/node/23229, and check the menu on the left side for more. Hope this helps!