Same name and namespace in other branches
  1. 4.7.x modules/node.module \node_page_default()
  2. 5.x modules/node/node.module \node_page_default()
  3. 6.x modules/node/node.module \node_page_default()
  4. 7.x modules/node/node.module \node_page_default()

Generate a listing of promoted nodes.

File

modules/node.module, line 1647
The core that allows content to be submitted to the site.

Code

function node_page_default() {
  $result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
  if (db_num_rows($result)) {
    drupal_add_link(array(
      'rel' => 'alternate',
      'type' => 'application/rss+xml',
      'title' => 'RSS',
      'href' => url('node/feed', NULL, NULL, TRUE),
    ));
    $output = '';
    while ($node = db_fetch_object($result)) {
      $output .= node_view(node_load(array(
        'nid' => $node->nid,
      )), 1);
    }
    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
  }
  else {
    $output = t("\n      <p>Welcome to your new <a href=\"%drupal\">Drupal</a>-powered website. This message will guide you through your first steps with Drupal, and will disappear once you have posted your first piece of content.</p>\n      <p>The first thing you will need to do is <a href=\"%register\">create the first account</a>. This account will have full administration rights and will allow you to configure your website. Once logged in, you can visit the <a href=\"%admin\">administration section</a> and <a href=\"%config\">set up your site's configuration</a>.</p>\n      <p>Drupal comes with various modules, each of which contains a specific piece of functionality. You should visit the <a href=\"%modules\">module list</a> and enable those modules which suit your website's needs.</p>\n      <p><a href=\"%themes\">Themes</a> handle the presentation of your website. You can use one of the existing themes, modify them or create your own from scratch.</p>\n      <p>We suggest you look around the administration section and explore the various options Drupal offers you. For more information, you can refer to the <a href=\"%handbook\">Drupal handbooks online</a>.</p>", array(
      '%drupal' => 'http://www.drupal.org/',
      '%register' => url('user/register'),
      '%admin' => url('admin'),
      '%config' => url('admin'),
      '%modules' => url('admin/modules'),
      '%themes' => url('admin/themes'),
      '%handbook' => 'http://www.drupal.org/handbooks',
    ));
  }
  return $output;
}