Somewhere between design and development

Read More link in Drupal

In a moment of wondering how to get the 'Read more' link in teasers I came across a module that does this. I felt that that would be overkill and so I had a poke around in node.tpl.php and found that, unsurprisingly, there are the two variables you need to do this easily from within a template ($teaser is a boolean for whether a node is a teaser or full, and $node_url is for the link).

I'm guessing that the reason for the module is that some people are happier installing a module rather than adding:

1  <?php if ($teaser) {?>
2    <a href="<?php print $node_url;?>" class="node_read_more">
3    <?php print t("Read more");?></a>
4  <?php }?>

 

to the bit after print $content in the node.tpl.php file.