Posted by tobe on February 22, 2008 at 9:53pm
I want the "Read more" link to be displayed right behind the teaser. Not in a new line, and not in the $links section. I managed to strip out the "Read more" tag from the $links array, but now it's just showing up right beneath the teaser. I want it to be shown right after the last word in the teasers $content.
Here is the code in my node.tpl.php:
<div class="content"><?php print $content?></div>
<div class="kreta"><?php
// Extract "read more" link from $links so we can display it separately.
if (preg_match('!<a[^>]+>'.t('Read more').'</a>!', $links, $match)) {
$links = preg_replace(/<a.+?href.+?>'.t('Read more').'<\/a>/i', '', $links);
$more = '<div class="links">'. $match[0] . '</div>';
$more = str_replace ("Read more", "Read the rest of the posting...", $more);
}
else {
$more = '<span class="readmore-fill"></span>';
}
if ($more) { print $more; }
?>
</div>
<div class="meta">
<?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
<div style="clear: both;"> </div>
</div>
Comments
You could try removing the
You could try removing the paragraph tags in the content variable in the node.tpl.php file.
$content = trim($content, '<p>');I need the <p>
It looks like I need the
<p>tag to hold together my theme layout. I'm not an advanced programmer. The Hack above to separate the "Read more" link from $links I got from some website. That means I don't always know what the code actually does.Is there a way to get the "Read more" link inside the $content content. So that it would be displayed right after the last word in the teaser?