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:
<?phpfunction _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;}?>
<div class="content"> <?php //for teasersif ($page == 0) { print $cck_teaser;} //for fullpageselse { print $node->field_body[0]['value'];?>} ?></div>
Recent comments
1 day 4 hours ago
3 days 3 min ago
3 days 1 hour ago
3 days 6 hours ago
3 days 6 hours ago
3 days 8 hours ago
3 days 8 hours ago
3 days 10 hours ago
3 days 13 hours ago
3 days 13 hours ago