I haven't been able to figure out how I can customize the teaser in the full node view. I understood that the text safed as teaser (I'm using the excerpt module) only appears in lists, not in the full node view. But there must be a way to assign a css class to the first paragraph of the body text (which I use as teaser), right? Right now, the body comes as a whole, just having the first paragraph as all the others. What if I want to, let's say, make the teaser (i.e. the first paragraph) bold?

Can anybody help me with that?

Comments

esllou’s picture

you should go and look at ConTemplate. I think it will do what you want. When you go in to edit the main body using ConTemplate, the teaser is loaded too, so I should think you'll be able to play around with that.

yan’s picture

thanks esllou, but that doesn't help me. It doesn't really matter if I change the template with contemplate (which I tried) or in a node-.tpl.php file. The problem is that in the full node view the teaser and the body come in one variable. If I put the following, only the body shows up in full node view:

<div id="teaser"><?php  print $node->teaser ?></div>
<div id="body"><?php  print $node->body ?></div>
yan’s picture

I'm still in trouble with this, no ideas? Anyone?

IGadmin’s picture

I'm running into the same thing. Am trying to display the teaser of a node in the body of the node, and am also simply trying to print $node->teaser, to no avail. Can print $node->title no problem, or body, but the teaser doesn't show. Can someone share the technique for displaying a teaser, ideally with full PHP code?

yan’s picture

I think my solution will be assigning a CSS class to the first paragraph of the node manually. This way at least I can change the look of that first paragraph easily. But it doesn't look like the best solution to me since it makes necessary put the class each time I publish an article.

guldi’s picture

in d6 this works just fine:


  // this is neccessary to get the body-text with the <!--break-->
  $tmp = node_load($node->nid);
  
  // now split up the whole text
  $splitted = split('<!--break-->', $tmp->body);

  // giveout the teaser
  print '<div class="teaser">' . $splitted[0] . '</div>';
  
  // unset the teaser text and get the text together again
  // this is just to be sure that no fragment gets lost
  $splitted[0] = '';
  $new_body = implode($splitted);
  
  // give out the rest of the text as body
  print '<div class="body">' . $new_body . '</div>';

maybe it helps somebody.

miwsio’s picture

I works great!!!

But I have one problem: when I use that code, the JW Player module (http://www.longtailvideo.com/addons/modules/136/JW-Player-Module-for-Drupal) doesn't work - it shows only the code with [jwplayer...] but not a player. Can you guess why - and what to do with that?