I'm creating a trivia site, and I'm setting up the teaser as the question and the user clicks "read more" to see the answer. But, I don't want it to say "read more". I'd rather it say "answer". I can't find any place to make this change. Could someone point me in the right direction?

Also, has anyone seen a trivia drupal site? I'd love to see an example.

Comments

kmillecam’s picture

The recommended way is to find the themeable function and modify its output at the theme level.

You can also open node.module with a text editor, search for "read more", and change it to "answer".

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

Sverre’s picture

Firstly I would NOT advise changing node.module. This will affect ALL of your nodes!

Look for node.tpl.php in the theme folder you are using under themes.

Copy the file and rename it node-story.tpl.php. NOTE: Replace story with the type of node which you are using for your questions.

Open node-story.tpl.php and look for this line:

<?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>

Replace it with this code:

<?php if ($links) { ?><div class="links">&raquo; <?php print str_replace('TEXT TO REPLACE', 'NEW TEXT', $links) ?></div><?php }; ?>

Modify 'TEXT TO REPLACE' and 'NEW TEXT' to suit your needs.

I forsee that you will also want to change the text that appears when the pointer is over the link... It is possible to 'nest' str_replace functions as follows:

<?php if ($links) { ?><div class="links">&raquo; <?php print str_replace('SECOND TEXT TO REPLACE', 'SECOND NEW TEXT', str_replace('FIRST TEXT TO REPLACE', 'FIRST NEW TEXT', $links)) ?></div><?php }; ?>

Upload your modified node-story.tpl.php and hopefully you will have your desired result.

kmillecam’s picture

That's an excellent explanation, Sverre!

Thanks for taking the time to spell it out.

Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

mindprint’s picture

Thank you. I'll give it a shot.

mindprint’s picture

Unfortunately, it did not work. Any other ideas?

drakeguan’s picture

Awesome!!!

This is what I need: not modifying node.module or theme engine but just theme templates because that's safer and more flexible. And you can make use of preg_replace to change whatever you want. awesome!

DJoh’s picture

that was a great suggestion, Sverre. Thanks!
Just for reference, I was simply trying to change the "Read More" text because very few users even realize that they're only looking at an excerpt - nobody was clicking them! Especially on the blogs, where it showed "Someone's blog - Read more" so it looked like you'd just be linking to their blog.

editing theme_dir/node.tpl.php and inserting the str_replace(1st_text,2nd_text,$links) instead of just $links is a perfect solutions, thanks. (I was originally looking in excerpt.module, blog.module, I really couldn't locate where "read more" originated from! With this fix, i suppose it doesn't matter)

coupling that with CSS styling (in theme_dir/styles.cs) like the following, really let me customize and make more apparent the previously unused Read More link.

for those who are learning, like me, here's what I did.
fyi, this is for Drupal v4.6.11, so it looks alittle different in the node.tpl.php
node.tpl.php:

  <?php if ($links): ?>
    <div class="links"><?php print str_replace('read more', 'Read Full Article', $links) ?></div>
  <?php endif; ?>

style.css:

/* Alter "Read More" and "Add comment" links placement	- #links, .read-more	*/
#main .info, .terms	{	/* move the author+date & vocab terms to right side	*/
	float: right;
}
#main .info	{	/* author, date etc.	*/
	font-size: 9pt;
}
#main .terms	{	/* links to taxonomy - lists of related articles	*/
	font-size: 10pt;
}
#main .links	{	/* container for info + readmore, on blogs only?	*/
	font-size: 10pt;
}

#main div.links, #main div.terms, #main div.info	{
	padding-right: 1em;
	background: #f0f0f0;
	height: 1.5em;
}
	
#main .links a.read-more {	/* move Read More link to left	*/
	font-size: 12pt;
	color: #D43402;
	float: left;
	line-height: 80%;
	text-transform: capitalize;
	font-variant: small-caps;
	font-weight: bold;
}

#main .links a.read-more:visited	{
	color: #D43402;
}

This makes the whole thing look like a bar between excerpts, with "Read full Article" on left, other links in middle, info/taxonomy on right.
depending on how soon you click, you may be able to see it here:
http://www.SarahHouseSB.org/events

mindprint’s picture

I decided to just alter the node.module. It's okay that it will effect other themes.

Thanks for your help.

Sverre’s picture

Just out of interest, what node type are you using for your questions?

mindprint’s picture

story

deplifer’s picture

One could also use the locale module, search fro the string and replace it with the text one would have in mind.