Quick and Clean CCK teasers Via PHPtemplate

If you are like me, you've been pulling your hair out trying to make teasers work in CCK. Well, as it so happens, I figured out a crazy simple phptemplate method of making CCK body fields act like any other node's body. Observe:

Template.php

<?php function _phptemplate_variables($hook, $vars) { global $user; switch ($hook) { case 'node': if ($vars['field_body'][0]['value']) { /* Believe it or not, all you have to do is pass the field through the existing node.module function node_teaser()! */ $vars['cck_teaser'] = node_teaser($vars['field_body'][0]['value'], $format = NULL); } break; } return $vars; } ?>

Drop this in the appropriate node.tpl.php file:

<?php //for teasers if ($page == 0) { print $cck_teaser; } //for fullpages else { print $node->field_body[0]['value'];?> } ?>