Thanks in advance for any help on this.

I'm looking for a way using node.tpl.php to display the "full node" in (what I think is) "teaser view" if content type is equal to "page."

I tried:

<?php if ($page == 0 && $node->type=='page') { ?>
<div class="node"><?php print $node?></div>

but instead of displaying the node, i just got the node's id.

Any suggestions?

Thanks again,
Scott

Comments

kleingeist’s picture

i think there is no wy to reach this using only the template system. i just looked through the code and found the following code in node.module:

  // unset unused $node part so that a bad theme can not open a security hole
  if ($teaser) {
    unset($node->body);
  }
  else {
    unset($node->teaser);
  }

  return theme('node', $node, $teaser, $page);

so there is no body data left in the template, when a teaser is requested.

But you could write a new module using hook_nodeapi to change the teaser to the complete content. It should contain something similar to this:

// ATTENTION: this code is untested
function yourmodule_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { 
  // overwrite teaser with content of body in case of nodetype "page"
  if ($teaser && $op == 'view' && $node->type == 'page') {
    $node->teaser = check_markup($node->body, $node->format, FALSE);
  }
}

hope this helps

Sc0tt’s picture

I'll dive into your suggestions and give them a try.

Thanks very much!
Sc0tt

drawk’s picture

I'm sorry that I don't have the time to test this at the moment, but couldn't you simply do (if $page == 0) print $content?

(that is, replace your print $node with print $content)

---
www.whatwoulddrupaldo.org

kleingeist’s picture

i could not sleep so i build the module (well the hook_help actually ;), i suggested. But while doing that, i retought the complete matter. What do you mean by "full node"? Only the complete body text? Or did you mean something like the actual node/x page with comments and tabs etc?

Well this is the module i suggested. just change the array $types to the node types you would like to "untease". Remember this will deny the use of the teaser on every page. If you want this only on specific pages/lists try the views.module which has a option for generating pages with "full nodes" listings.

function noteaser_help($section='') {
  $output = '';
  switch ($section) {
    case "admin/modules#description":
      $output = t("Replaces teasers by the complete body for specific node types.");
      break;
  }
  return $output;
}

function noteaser_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) { 
  // list of node types which should ALLWAYS show the full content.   
  $types = array('page', 'story');
  
  if ($teaser && $op == 'view' && in_array($node->type, $types)) {
    // rebuild teaser with full body content
    $node->teaser = check_markup($node->body, $node->format, FALSE);
  }
}