/[drupal]/contributions/sandbox/frjo/latest_storys/latest_storys.module
ViewVC logotype

Contents of /contributions/sandbox/frjo/latest_storys/latest_storys.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Tue Jun 5 06:52:10 2007 UTC (2 years, 5 months ago) by frjo
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
Drupla 5 versions.
1 <?php
2 // $Id: latest_storys.module,v 1.1 2005/11/20 15:57:30 frjo Exp $
3
4 /**
5 * Implementation of hook_block().
6 *
7 * Generates a block with the latest storys.
8 * $nlimit sets the number of storys to display
9 * $nodetyp sets the node type to display
10 */
11 function latest_storys_block($op = 'list', $delta = 0) {
12 if ($op == 'list') {
13 $block[0]['info'] = t('Latest articles');
14 return $block;
15 }
16 else if ($op == 'view') {
17 if (user_access('access content')) {
18 $nlimit = 15;
19 $nodetyp = 'story';
20 $block['subject'] = t('Latest articles');
21 $block['content'] = node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = '%s' AND n.status = 1 ORDER BY n.created DESC"), $nodetyp, 0, $nlimit));
22 }
23 return $block;
24 }
25 }

  ViewVC Help
Powered by ViewVC 1.1.2