You are here

function phptemplate_node in Drupal 4

Same name and namespace in other branches
  1. 5 themes/engines/phptemplate/phptemplate.engine \phptemplate_node()

File

themes/engines/phptemplate/phptemplate.engine, line 220
Handles integration of templates written in pure php with the Drupal theme system.

Code

function phptemplate_node($node, $teaser = 0, $page = 0) {
  if (module_exist('taxonomy')) {
    $taxonomy = taxonomy_link('taxonomy terms', $node);
  }
  else {
    $taxonomy = array();
  }
  $variables = array(
    'content' => $teaser && $node->teaser ? $node->teaser : $node->body,
    'date' => format_date($node->created),
    'links' => $node->links ? theme('links', $node->links) : '',
    'name' => theme('username', $node),
    'node' => $node,
    // we pass the actual node to allow more customization
    'node_url' => url('node/' . $node->nid),
    'page' => $page,
    'taxonomy' => $taxonomy,
    'teaser' => $teaser,
    'terms' => theme('links', $taxonomy),
    'title' => check_plain($node->title),
  );

  // Flatten the node object's member fields.
  $variables = array_merge((array) $node, $variables);

  // Display info only on certain node types.
  if (theme_get_setting('toggle_node_info_' . $node->type)) {
    $variables['submitted'] = t('Submitted by %a on %b.', array(
      '%a' => theme('username', $node),
      '%b' => format_date($node->created),
    ));
    $variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
  }
  else {
    $variables['submitted'] = '';
    $variables['picture'] = '';
  }
  return _phptemplate_callback('node', $variables, 'node-' . $node->type);
}