Update: appparently, today was the day to write about this. Nedjo Rogers submitted a handbook page that shows a different method of achieving the same end.
For the most part, Drupal 4.7's block system is underutilized. This is a shame; with the proper templating, drupal's block system can become a valuable workhorse. In this tutorial, you will learn:
By the end of this tutorial, you will have the ability to place blocks into node's like a so:
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> Ah, chickens -- delicious chickens. Its a timeless truth, however, that not all chickens were born equal. And clearly, the best tasting chickens are those who've been allowed to feed, graze, and socialize on the open range.
Alas, this is not a white paper on the art of raising free-range chickens. Rather, its a tutorial on raising free-range node.tpl.php links such as "add new comment", "read more", or any other link which the multitudes of modules spew forth into that disgustingly generic $links variable. By the end of this tutorial you will no longer be limted by the $links variable. Instead, you will have the necessary code and knowledge to turn any link into a variable that you can place at any point in your node.tpl.php file.
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