I'm using a function from here to reposition and rename my Read More link on my teasers. The link is moved up fine but the » symbol prints out as text i.e. ampersand followed by the word raquo and semicolon. However if I move the code for » outside of the l() function the correct symbol shows up. But obviously then it is not part of the link. Anyone know what is causing this problem? I am totally stumped!

Function is below for reference.

function myhacks_nodeapi(&$node, $op, $teaser, $page) {
// This moves the Read More link up next to the teaser text and changes
// the link title to More >>	
	
  if ($op == 'view' && $teaser && $node->readmore) {
    $node->readmore = false;
    $read_more = "<span class='read-more'> " . l(t('More &raquo;'),"node/$node->nid", array('absolute' => TRUE, 'html' => FALSE)) . " </span>";
    $node->content[body]['#value'] = substr_replace($node->content[body]['#value'], $read_more, strrpos($node->content[body]['#value'], '</p>'), 0);
  }
}

Comments

pbull’s picture

The l() function takes an array of options -- one of them is 'html', which determines whether the text of the link is rendered as html or not. In your code above, the html value is set to FALSE, so the &raquo; symbol is being rendered as text. Set that value to TRUE:

$read_more = "<span class='read-more'> " . l(t('More &raquo;'),"node/$node->nid", array('absolute' => TRUE, 'html' => TRUE)) . " </span>";
mistresskim’s picture

Oh sh*t. How embarrassing! Thanks for responding.

geerlingguy’s picture

Extremely helpful; I didn't even think of that.

__________________
Personal site: www.jeffgeerling.com