I have created an image_gallery content type. I would like the teasers on the fron page of my site to have a link that says "View All Pictures" instead of "Read More". I have created a template file for this content type and figured out that the block below handles the link.

<?php if ($links): ?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>

How can I modify that section to read "View All Pictures" and link to the full page of content? Is this possible in the template file for the content type?

Comments

p6’s picture

You have a bunch of options

1. Write a custom module and implement hook_link_alter() (D6 only)
2. The template stuff ofcourse. Reimplement phptemplate_links as necessary into your new theme.
3. Do it with ReadMore Tweak? (Not sure)
4. Do it with Contemplate by manually coding whatever you'd want into the teaser

- Pavan Keshavamurthy
http://grahana.net/

- Pavan Keshavamurthy
http://grahana.net/

tms8707056’s picture

I actually figured out a way to do it. I used the Custom Links module to insert the new "View All Photos" link. I removed the "Read more" link with code I found over at FreshBlurbs.com for moving the "Read more" link.

Original code (http://www.freshblurbs.com/how-hack-read-more-drupal):

<?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 align="right">'. $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; }

?>

Remove the following line to prevent the link from displaying on teasers.

if ($more) { print $more; }
marketacumen’s picture

I had this exact same issue and in Drupal 7, thought I could alter the locale to modify the "Read more" link in taxonomy teaser list views.

I could, by editing in settings.php like this:

$conf['locale_custom_strings_en'] =
array(
	'' => array(
		'Read more<span class="element-invisible"> about @title</span>' => 'Product Data'
	),
);

Problem is, then all content types show "Product Data", and I just want it for "Products."

The fix is to patch the node.module, which I know is a no-no, but unfortunately, it's not leveraging the context option which allows the translation to serve a context of where it's translating something. So the following change in node.module:

1375c1375
<       'title' => t('Read more<span class="element-invisible"> about @title</span>', array('@title' => $node_title_stripped)),
---
>       'title' => t('Read more<span class="element-invisible"> about @title</span>', array('@title' => $node_title_stripped), array('context' => $node->type)),

Allows me to modify "Read more" based on the content type. Much cleaner. Not sure how to propose this change as a patch.

Final result:

$conf['locale_custom_strings_en'] =
array(
	'product' => array(
		'Read more<span class="element-invisible"> about @title</span>' => 'Product Data<span class="element-invisible"> product data for @title</span>'
	),
	'case-history-type' => array(
		'Read more<span class="element-invisible"> about @title</span>' => 'Learn more<span class="element-invisible"> learn more about @title</span>'
	),
);

Cheers.

mgifford’s picture

Wanted to link back from here to https://drupal.org/node/49428