Drupal API 常用函数

comment_num_all($nid):调用评论数,$nid为node的ID,当前node可用$node->nid。

taxonomy_get_tree($vid):显示分类(item),vid为category的ID,必须是category,不能是item,也就是说只能显示父层下面的item。

taxonomy_get_children($tid):显示Item下面的item,$tid为父item的id。

menu_get_menu():Return the menu data structure.不带参数,显示系统所有的menu。

menu_primary_links($start_level = 1, $pid = 0):pid可以指定起始层数,start_level貌似意思也差不多,还没实验过,有时间试试再说,下面是英文说明:
$start_level This optional parameter can be used to retrieve a context-sensitive array of links at $start_level levels deep into the Primary links menu. The default is to return the top-level links.

$pid The parent menu ID from which to search for children. Defaults to the menu_primary_menu setting.

menu_overview_tree:Present the menu tree, rendered along with links to edit menu items.

menu_get_item($mid, $path = NULL):Retrieves the menu item specified by $mid, or by $path if $mid is not given.

node_last_viewed:Retrieves the timestamp at which the current user last viewed the specified node.放在首页可以返回用户上次访问网站的时间。

referer_uri:Return the URI of the referring page.可以用来统计来源页面。

request_uri:Since $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.任何服务器系统下面都可以使用。

sess_count($timestamp = 0, $anonymous = true):Counts how many users have sessions. Can count either anonymous sessions, authenticated sessions, or both.貌似可以分别统计在线会员与游客数了。可以通过指定$timestam来实现15分钟内在线人数效果。

statistics_title_list($dbfield, $dbrows):
Description

Returns all time or today top or last viewed node(s).

Parameters

$dbfield one of

* ‘totalcount’: top viewed content of all time.
* ‘daycount’: top viewed content for today.
* ‘timestamp’: last viewed node.

$dbrows number of rows to be returned.

Return value

A query result containing n.nid, n.title, u.uid, u.name of the selected node(s) or FALSE if the query could not be executed correctly.

t($string, $args = 0):Translate strings to the current locale.

All human-readable text that will be displayed somewhere within a page should be run through the t() function.

taxonomy_get_parents($tid):Find all parents of a given term ID.

taxonomy_get_parents_all($tid):Find all ancestors of a given term ID.

taxonomy_get_related($tid):Find all term objects related to a given term ID.

taxonomy_get_term($tid):Return the term object matching a term ID.

taxonomy_get_vocabularies():Return an array of all vocabulary objects.

taxonomy_node_get_terms($nid):Find all terms associated with the given node, ordered by vocabulary and term weight.

taxonomy_node_get_terms_by_vocabulary($nid, $vid, $key = ‘tid’):Find all terms associated with the given node, within one vocabulary.

taxonomy_overview_terms($vid):Display a tree of all the terms in a vocabulary, with options to edit each one.

taxonomy_overview_vocabularies():List and manage vocabularies.

taxonomy_term_count_nodes($tid):Count the number of published nodes classified by a term.

theme_block($block):Return a themed block.

You can style your blocks by defining .block (all blocks), .block-module (all blocks of module module), and \#block-module-delta (specific block of module module with delta delta) in your theme’s CSS.

theme_box($title, $content, $region = ‘main’):Return a themed box.
Parameters
$title The subject of the box.
$content The content of the box.
$region The region in which the box is displayed.

theme_breadcrumb($breadcrumb):Return a themed breadcrumb trail.

theme_closure():Execute hook_footer() which is run at the end of the page right before the close of the body tag.用在之前用来结束页面,如果不加此函数,fckeditor不显示。

你可能感兴趣的:(Drupal API 常用函数)