modules/node/node.module, строка 696
- 5 – 6
node_load($param = array(), $revision = NULL, $reset = NULL)
Загружает объект ноды из базы данных.
Параметры
$param
Или nid ноды, или массив условий соответствия для запроса к базе данных.
$revision
Какой номер ревизии ноды загружать. По умолчанию используется текущая ревизия.
$reset
Стоит ли обновить внутренний (static) кеш.
Возвращаемое значение
Полный объект ноды.
Load a node object from the database.
Parameters
$param
Either the nid of the node or an array of conditions to match against in the database query
$revision
Which numbered revision to load. Defaults to the current version.
$reset
Whether to reset the internal node_load cache.
Return value
A fully-populated node object.
- batch_example_op_1 in developer/examples/batch_example.module
- Batch operation for batch 1 : lode a node...
- batch_example_op_2 in developer/examples/batch_example.module
- Batch operation for batch 2 : load all nodes, 5 by five
This is a multipart operation, using the
- blogapi_blogger_edit_post in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Модифицирует указанную ноду блога.
- blogapi_blogger_get_post in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Возвращает указанную ноду блога.
- blogapi_mt_get_post_categories in modules/blogapi/blogapi.module
- Blogging API callback. Returns a list of the taxonomy terms that are
assigned to a particular node.
- blogapi_mt_publish_post in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Публикует данную ноду.
- blogapi_mt_set_post_categories in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Связывает термины таксономии с указанной нодой.
- blog_form in modules/blog/blog.module
- Реализация hook_form().
- blog_page_last in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блогах пользователей.
- blog_page_user in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блоге данного пользователя.
- book_admin_edit_submit in modules/book/book.admin.inc
- Handle submission of the book administrative page form.
- book_export_html in modules/book/book.pages.inc
- This function is called by book_export() to generate HTML for export.
- book_export_traverse in modules/book/book.module
- Traverse the book tree to build printable or exportable output.
- book_form_node_delete_confirm_alter in modules/book/book.module
- Функция изменения формы подтверждения единичного удаления ноды.
- book_nodeapi in modules/book/book.module
- Implementation of hook_nodeapi().
- comment_form in modules/comment/comment.module
- Создаёт базовую форму для комментирования, которая будет добавлена к странице с нодой или отображена на отдельной странице.
- comment_form_add_preview in modules/comment/comment.module
- Конструктор формы; Формирует и проверяет форму предпросмотра комментария.
- comment_form_submit in modules/comment/comment.module
- Process comment form submissions; prepare the comment, store it, and set a redirection target.
- comment_links in modules/comment/comment.module
- Формирует управляющие ссылки для комментариев (редактировать, ответить, удалить) на основе прав доступа для текущего пользователя.
- comment_validate in modules/comment/comment.module
- Проверка данных комментария.
- hook_search in developer/hooks/core.php
- Определяет пользовательскую функцию поиска.
- hook_update_index in developer/hooks/core.php
- Обновляет полнотекстовый индекс Друпала для данного модуля.
- node_access_rebuild in modules/node/node.module
- Rebuild the node access database. This is occasionally needed by modules
that make system-wide changes to access levels.
- node_delete in modules/node/node.module
- Удаляет ноду.
- node_feed in modules/node/node.module
- A generic function for generating RSS feeds from a set of nodes.
- node_help in modules/node/node.module
- Реализация hook_help().
- node_page_default in modules/node/node.module
- Menu callback; Generate a listing of promoted nodes.
- node_search in modules/node/node.module
- Реализация hook_search().
- poll_block in modules/poll/poll.module
- Реализация hook_block().
- poll_cancel in modules/poll/poll.module
- Submit callback for poll_cancel_form
- profile_block in modules/profile/profile.module
- Реализация hook_block().
- statistics_node_tracker in modules/statistics/statistics.pages.inc
- system_message_action in modules/system/system.module
- A configurable Drupal action. Sends a message to the current user's screen.
- system_send_email_action in modules/system/system.module
- Implementation of a configurable Drupal action. Sends an email.
- taxonomy_render_nodes in modules/taxonomy/taxonomy.module
- Принимает результат вызова pager_query(), такой как, например, возвращает taxonomy_select_nodes(), и форматирует каждую ноду вместе с листалкой страниц.
- translation_nodeapi in modules/translation/translation.module
- Implementation of hook_nodeapi().
- translation_node_overview in modules/translation/translation.pages.inc
- Overview page for a node's translations.
- translation_path_get_translations in modules/translation/translation.module
- Return paths of all translations of a node, based on
its Drupal path.
- upload_file_download in modules/upload/upload.module
- Implementation of hook_file_download().
- _node_access_rebuild_batch_operation in modules/node/node.module
- Batch operation for node_access_rebuild_batch.
- _node_index_node in modules/node/node.module
- Индексирует одну ноду.
- _node_mass_update_helper in modules/node/node.admin.inc
- Node Mass Update - helper function.
- _node_revision_access in modules/node/node.module
- _trigger_normalize_comment_context in modules/trigger/trigger.module
- When an action is called in a context that does not match its type,
the object that the action expects must be retrieved. For example, when
an action that works on nodes is called during the comment hook, the
node object is not available since the...
- _trigger_normalize_user_context in modules/trigger/trigger.module
- When an action is called in a context that does not match its type,
the object that the action expects must be retrieved. For example, when
an action that works on nodes is called during the user hook, the
node object is not available since the user...
Код
<?php
function node_load($param = array(), $revision = NULL, $reset = NULL) {
static $nodes = array();
if ($reset) {
$nodes = array();
}
$cachable = ($revision == NULL);
$arguments = array();
if (is_numeric($param)) {
if ($cachable) {
if (isset($nodes[$param])) {
return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
}
}
$cond = 'n.nid = %d';
$arguments[] = $param;
}
elseif (is_array($param)) {
foreach ($param as $key => $value) {
$cond[] = 'n.'. db_escape_table($key) ." = '%s'";
$arguments[] = $value;
}
$cond = implode(' AND ', $cond);
}
else {
return FALSE;
}
$fields = drupal_schema_fields_sql('node', 'n');
$fields = array_merge($fields, drupal_schema_fields_sql('node_revisions', 'r'));
$fields = array_merge($fields, array('u.name', 'u.picture', 'u.data'));
$fields = array_diff($fields, array('n.vid', 'n.title', 'r.nid'));
$fields = implode(', ', $fields);
$fields = str_replace('r.timestamp', 'r.timestamp AS revision_timestamp', $fields);
$fields = str_replace('r.uid', 'r.uid AS revision_uid', $fields);
if ($revision) {
array_unshift($arguments, $revision);
$node = db_fetch_object(db_query('SELECT '. $fields .' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE '. $cond, $arguments));
}
else {
$node = db_fetch_object(db_query('SELECT '. $fields .' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond, $arguments));
}
if ($node && $node->nid) {
if ($extra = node_invoke($node, 'load')) {
foreach ($extra as $key => $value) {
$node->$key = $value;
}
}
if ($extra = node_invoke_nodeapi($node, 'load')) {
foreach ($extra as $key => $value) {
$node->$key = $value;
}
}
if ($cachable) {
$nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node;
}
}
return $node;
}
?>
Войдите или
зарегистрируйтесь, чтобы получить возможность отправлять комментарии