继续Drupal分享精神 QQ群:107748121 站长QQ:532116351【drupal交流+drupal 建站+theme制作】
登录 注册

区块定义-推荐标题变成红色

上次定了一个公司最新公司动态的区块(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;
}
?>

具体效果如图所示:

评论

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.