Unwanted markup in $node->body
dmclark - January 14, 2009 - 15:57
Hi,
I'm fairly new to theming and I have an issue that has me stumped.
my site was originally the b7 theme, but have added a template.php
I am trying to create a view for the homepage that has some content and then the latest news.
I created a content type and have the right items being displayed.
I made a node-news_item.tpl.php that has:
<div class="node <?php print ($sticky && $page==0) ? " sticky" : ""; ?> ">
<div class="content">
<?php print format_date($node->created,'custom', 'F j, Y') ?> <?php print $content ?>
</div>
</div>the problem is that $content is wrapped in a <p> as in:
<div class="content">
December 29, 2008 <p><b>The Massachusetts Early Education and Care and Out-of-School Time Task Force </b>has released a <a href="/files/Steps%20Forward%20PowerPoint.pdf" target="_blank">PowerPoint</a> presentation highlighting their recommendations.<b> </b>View the <a href="/files/Steps%20Forward%20PowerPoint.pdf" target="_blank"><b>Steps Forward</b> PowerPoint</a> presentation <a href="/files/Steps%20Forward%20PowerPoint.pdf" target="_blank">here</a>. </p>
</div>even though I have the following in template.php
<?php
function B7_node($node, $teaser = 0, $page = 0) {
if (module_exists('taxonomy')) {
$taxonomy = taxonomy_link('taxonomy terms', $node);
}
else {
$taxonomy = array();
}
$variables = array(
'content' => ($teaser && $node->teaser) ? $node->teaser : $node->body,
'date' => format_date($node->created),
'links' => $node->links ? theme('links', $node->links, array('class' => 'links inline')) : '',
'name' => theme('username', $node),
'node' => $node, // we pass the actual node to allow more customization
'node_url' => url('node/'. $node->nid),
'page' => $page,
'taxonomy' => $taxonomy,
'teaser' => $teaser,
'terms' => theme('links', $taxonomy, array('class' => 'links inline')),
'title' => check_plain($node->title)
);
// Flatten the node object's member fields.
$variables = array_merge((array)$node, $variables);
// Display info only on certain node types.
if (theme_get_setting('toggle_node_info_' . $node->type)) {
$variables['submitted'] = t('Submitted by !a on @b.', array('!a' => theme('username', $node), '@b' => format_date($node->created)));
$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
}
else {
$variables['submitted'] = '';
$variables['picture'] = '';
}
return _phptemplate_callback('node', $variables, array('node-' . $node->type));
}
?>what am I not getting?

The input filter being used
The input filter being used probably has the "Line break converter" enabled. You will either need to remove all newlines from the post or add a filter with the "Line break converter" disabled.