Template upgrade from 6 to 7

by brian   Last Updated July 18, 2017 16:07 PM

I've a custom D6 node template that I inherited and am looking for some pointers on upgrading it to D7.

The following is a snippet from a long template which basically takes a number of node references and outputs them for a newsletter to send it through a mailing service.

I've been looking at https://www.drupal.org/node/254940 but wondered if anyone had a good reference to share or some good pointers. Is it a matter of just using the right syntax, or is some of this functionality that should be put in template.php?

<?php
$intro = $node->field_introduction[0]['view'];
$intro_clean = str_replace("<br />","",$intro);
print $intro_clean;
?>

<?php if ($node->field_this_weeks_news[0]['view']) {
print '<h2 style="font-size: 18px;font-weight: bold;color: #000000;margin: 20px 0 8px 0;"  class="field-label" id="news">This week\'s news</a></h2>';
        foreach ((array)$node->field_this_weeks_news as $item) {
                print "<p><b>";
                print str_replace('href="', 'href="http://example.com', $item['view']);
                print "</b><br />";
                $item_nid = $item['nid'];
                $item_node = node_load($item_nid);
                $item_node = node_build_content($item_node);
                $item_desc = $item_node->field_summary[0]['value'];
                $item_auth = $item_node->name;
                $item_terms = $item_node->taxonomy;
                print strip_tags($item_desc);
                print "<br />";
                $term_links = array();
                        foreach ($item_node->taxonomy as $term) {
                                if ( $term->vid == '14' ) {
                                        $term_links[] = $term->name;
                                }
                        }
                // "implode" makes the terms comma-separated
                print "<small>By ";
                print implode(', ', $term_links);
                print "</small></p>";
        }
}
?>
Tags : 7 theming 6 upgrading


Related Questions


Drupal 7 to drupal 8

Updated June 13, 2017 00:07 AM

This regular muscle boosting supplement works

Updated June 24, 2017 07:07 AM

Upgrading with Openshift

Updated November 04, 2016 09:03 AM

Best practice document for drupal core upgrades

Updated June 10, 2015 23:03 PM