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
39 sec ago
3 days 14 min ago
1 week 1 day ago
1 week 2 days ago
1 week 2 days ago
1 week 5 days ago
1 week 6 days ago
1 week 6 days ago
1 week 6 days ago
3 weeks 2 days ago