Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

Drupal: Display List of The Newest Node Titles

Submitted by on May 17, 2011 – 4:34 amNo Comment

In this article, I would tell you how to show a list of the newest nodes titles. The list will be sorted by creation date (the newest are on the top).

Solution:

Run the following PHP-code on a site::

<?php
/*

http://drupal.org/node/75781

Shows a list of nodes titles sorted out by their creation dates (the newest are on the top). The original snippet didn’t use the secure db_rewrite_sql() function.
*/
$list_no =10;
$sql = “SELECT n.title, n.nid FROM {node} AS n WHERE n.status = 1 AND n.title NOT LIKE ‘301%’ ORDER BY n.changed DESC LIMIT $list_no”;
$result=db_query(db_rewrite_sql($sql));
while ($anode = db_fetch_object($result)) $links[] = l($anode->title, “node/”. $anode->nid);
return theme_item_list($links);
?>

Good luck!

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.