Sorry if someone has already posted a support request about this but I was not able to find something about it.
When I modify the teaser code output, I have no "read more" way to show the rest of the post from the main page: I want to know if it is possible to have a way to call the "read more" feature with link to full-article with an image "a href whatit is" image "/a".
Thx a lot

CommentFileSizeAuthor
#5 contemplate_read_more_patch_5.x-1.8.patch522 bytesselmanj
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdornbush’s picture

If there is a long enough body to generate a trimmed version, the "read more" link will appear.

But what if there is not enough? I inserted the following into the Teaser Template. It will always generate a "read more..." link to the full node.

<a href="<?php print $base_path ?>/?q=node/<?php print $nid ?>">Read more...</a>

Of course, now I have two read more links in some cases. I changed it to

<?php if (!$node->readmore) {?><a href="<?php print $base_path ?>/?q=node/<?php print $nid ?>">Read more...</a><?php } ?>

and now my read more link appears only if the other read more link doesn't appear.

gareth_w’s picture

Thanks for the snippet, it's similar to what I have but more elegant.

My issue is that if I use this it redirects to /mysite/node/99 which is fine, but if my node has a URL set (e.g. /mysite/node/my_page) this is not displayed, and I would rather this (name) was bookmarked rather than the node/nid reference.

Do you know if a work-around for this is possible?

Thanks,
Gareth

joel_guesclin’s picture

Very late response - but personally I would use the Excerpt module which allows you to customise what you put in the Teaser

mikemccaffrey’s picture

Try this:

<?php print l("<img src='asdf.jpg'>", "node/".$node->nid, array(), NULL, NULL, FALSE, TRUE); ?> 

It will translate the node/id into whatever pathalias is set. All the extra arguments passed to the link function is to enable the last flag which lets you use html. You can't use $node->path due to a permissions bug for anonymous users.

selmanj’s picture

Version: 5.x-1.1 » 5.x-1.8
FileSize
522 bytes

I didn't like having my Read More link be separate from the other links relating to a node.

Here's my (not so great) solution. If a content type has the teaser output overridden within contemplate, display the read more link. This isn't the best solution since someone might be generating a teaser identical to the body, but I think it covers most users. I couldn't think of a better way of doing it, since the readmore flag has to be decided early-on in the node loading process. Hopefully someone better with CCK/contemplate can figure out a more appropriate solution.

See the attached patch for contemplate-5.x-1.8.

selmanj’s picture

Status: Active » Needs work
jrglasgow’s picture

Status: Needs work » Postponed (maintainer needs more info)

I don't see the point in the patch, There isn't a problem that I see with the way contemplate handles the 'Read More' display. You shouldn't need to patch the module to achieve this. I would use bdornbush's solution to solve this problem. If you see a problem where contemplate is stopping the 'Read more' from appearing when there is enough content to justify it I will look into applying this patch, or orchestrating my own solution to fix it.

gagarine’s picture

A read more link for contemplate, work with alias and clean url enabled or not:

<span class="readmore">» <a href="<?php print url(drupal_get_path_alias('node/'.$node->nid)); ?>">Read more</a></span>
KarimB’s picture

Try this one with the variable $node_url

<span class="readmore">» <a href="<?php print $node_url;?>"><?php print t("Read more");?></a></span>