phptemplate_node

5 phptemplate.engine phptemplate_node($node, $teaser = 0, $page = 0)

Prepare the values passed to the theme_node function to be passed into a pluggable template engine.

File

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

Code

function phptemplate_node($node, $teaser = 0, $page = 0) {
  if (module_exists('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, array('class' => 'links inline')) : '', 
    '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, array('class' => 'links inline')), 
    '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, array('node-' . $node->type));
}
Login or register to post comments