摘要: function ago($timestamp){ $difference = time() - $timestamp; $text = format_interval($difference, 2) . " 前"; return $text; }=--------------------------调用-----------ago($test->node_created) 例;1小时30分... 阅读全文
posted @ 2009-09-04 17:16 Pigg 阅读(133) 评论(0) 推荐(0) 编辑
摘要: theme_image例;theme_image(($test->users_picture),'user/'.$test->uid) 阅读全文
posted @ 2009-09-04 10:29 Pigg 阅读(117) 评论(0) 推荐(0) 编辑
摘要: drupal_substr($text, $start, $length = NULL)Drupal API 截取一段字符串例:l(drupal_substr($test->node_title, 0, 15).'...','node/'.$test->nid). 阅读全文
posted @ 2009-09-03 12:53 Pigg 阅读(143) 评论(0) 推荐(0) 编辑
摘要: drupal 的views确很强大~但用起来很麻烦。所以我们可以自定义输出内容。<?phpecho '<h2>最新story</h2>';$result = db_query_range("SELECT n.nid, n.title FROM {node} n WHERE n.type = 'story' ORDER BY n.created DESC", 10);$... 阅读全文
posted @ 2009-09-02 19:04 Pigg 阅读(473) 评论(0) 推荐(0) 编辑
摘要: format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL)$timestamp 确切的日期格式 要格式化的日期变量$type 要使用的格式(samll large medium custom)例 format_date($test->node_created,'cust... 阅读全文
posted @ 2009-09-02 18:59 Pigg 阅读(281) 评论(0) 推荐(0) 编辑