function node_page_default
Same name and namespace in other branches
- 6.x drupal-6.x/modules/node/node.module \node_page_default()
Menu callback: Generates a listing of promoted nodes.
Return value
array An array in the format expected by drupal_render().
See also
4 string references to 'node_page_default'
- drupal-6.bare.database.php in drupal-7.x/
modules/ simpletest/ tests/ upgrade/ drupal-6.bare.database.php - Bare installation of Drupal 6.17, for test purposes.
- drupal-6.filled.database.php in drupal-7.x/
modules/ simpletest/ tests/ upgrade/ drupal-6.filled.database.php - Filled installation of Drupal 6.17, for test purposes.
- menu_test_menu in drupal-7.x/
modules/ simpletest/ tests/ menu_test.module - Implements hook_menu().
- node_menu in drupal-7.x/
modules/ node/ node.module - Implements hook_menu().
Archivo
- drupal-7.x/
modules/ node/ node.module, line 2689 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Código
function node_page_default() {
$select = db_select('node', 'n')->fields('n', array('nid', 'sticky', 'created'))->condition('n.promote', 1)->condition('n.status', 1)->orderBy('n.sticky', 'DESC')->orderBy('n.created', 'DESC')->extend('PagerDefault')->limit(variable_get('default_nodes_main', 10))->addTag('node_access');
$nids = $select->execute()->fetchCol();
if (!empty($nids)) {
$nodes = node_load_multiple($nids);
$build = node_view_multiple($nodes);
// 'rss.xml' is a path, not a file, registered in node_menu().
drupal_add_feed('rss.xml', variable_get('site_name', 'Drupal') . ' ' . t('RSS'));
$build['pager'] = array(
'#theme' => 'pager',
'#weight' => 5,
);
drupal_set_title('');
}
else {
drupal_set_title(t('Welcome to @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), PASS_THROUGH);
$default_message = '<p>' . t('No front page content has been created yet.') . '</p>';
$default_links = array();
if (_node_add_access()) {
$default_links[] = l(t('Add new content'), 'node/add');
}
if (!empty($default_links)) {
$default_message .= theme('item_list', array('items' => $default_links));
}
$build['default_message'] = array(
'#markup' => $default_message,
'#prefix' => '<div id="first-time">',
'#suffix' => '</div>',
);
}
return $build;
}