上次定了一个公司最新公司动态的区块(http://hellodrupal.info/node/37 ),客户喜欢把推荐的新闻标题改为红色衔接,想到最简单的方法就是对于sticky的文件CSS定义一下就可以了。
借用了node_title_list. api 想了解更多此API 请访问 http://api.drupal.org/api/function/node_title_list
<?php
function pnode_title_list($result, $title = NULL) {
$items = array();
$num_rows = FALSE;
while ($node = db_fetch_object($result)) {
//在CSS定义 sticky_1 这是置顶的 "sticky_".$node->sticky.
$items[] ="<div class=\"sticky_".$node->sticky."\">".l($node->title, 'node/'.$node->nid, !empty($node->comment_count) ? array('attributes' => array('title' => format_plural($node->comment_count, '1 comment', '@count comments'))) : array())."</div>";
$num_rows = TRUE;
}
return
$num_rows ? theme('node_list', $items, $title) : FALSE;
}
?>
具体效果如图所示:

评论
发表新评论