How do I separate "read more" link from the rest of the element of the links array , in order to display separately, say, right after the node content's text.

Comments

doodikopf’s picture

I have accomplished this by adding the following code to my node.tpl.php at the desired position.

		<?php if ($node->readmore && !$page): //node is truncated and displayed in a context ?>
			<p align="right" class="whateveryouwant">
			... [<a href="<?php print $node_url ?>" class="read-more"><?php t('read more') ?></a>]</p>
		<?php endif; ?>

€dit: to remove the read more link added by drupal you'd have to hide it with CSS (display:none;) or ... no idea, .. maybe a littlebit of regular expression replacing would do the job.

regards

datamodel’s picture

I don't want to remove it. Just display it elsewhere from its default display position, in a vertical-bar-separated sequence of links contained in the $links array - used by the theme i'm using .
I'm trying out the code you suggested.

datamodel’s picture

Thank you very much.

But now how do I remove the "read more" link / element from the $node->$links array ? :))

korayal’s picture

you should use another class for the new readmore link. and set the old one's class to "display:none;"

vm’s picture

heres a another way to do it http://www.angrydonuts.com/the_nuisance_of_the_read_more_fl written by merlinofchaos.

datamodel’s picture

.

mcurry’s picture

I've created a pre-packaged drop-in Drupal module for Drupal 4.7 that implements the "read more" modifications mentioned on AngryDonuts.com:

http://exodusdev.com/drupal/4.7/modules/ed_readmore.module

Michael Curry - Exodus Development

datamodel’s picture

The "read more" link given in teaser view (eg, frontpage, blogs) sets the href url to $node_url .

On the "blogs" page, which gives teaser view for all blog posts, every "read more" link ends up pointing to the "blogs" page.
That is, the link points to

http://localhost/drupal-4.7.3/?q=blog

I tried this and it seems to work:

$output .= " ...<a href=\"?q=node/".$node->nid."\" class=\"links\">". t('read more') ."</a>\n";
dangrice’s picture

Any suggestions on how to place Read more in the $content part of the blog. (Within the div class "content") I'm looking to put "read more" directly after the teaser without any line breaks as it seems to more intuitive..

If anyone has ideas in Drupal 5, as I think this should be easier and the future..

dangrice’s picture

  <div class="content">
    <?php  print trim(trim($content), '</p>') ?>
    <?php if ($teaser) {print  " ...<a href=\"?q=node/".$node->nid."\" class=\"links\">". t('More') ."</a>\n";} ?>
    

  </div>

i figure this should work.. strip out the end paragraph tag in my content read out.. + new read more class as above..