Is it possible to separate the Comment link from Read More link in a Node?
Actually i want to move the Comment link at the top beside of "Submit by" info and keeping the Read More link at the bottom...
any ideas how to modify the node.tpl.php file?

thank you very much

Comments

narres’s picture

There is a nice explantation at http://drupal.org/node/36008 but you are also able to do things like that in node.tpl.php:

 $mynode=node_load($node->nid);
 $mydate = date("d.m.Y", $mynode->created);

instead of using the predefined variables like $content, $link, and so on.

Thomas Narres
Keep the sunny side up

Stefanos Karagos’s picture

thank you for ur reply
because my php knowlenge is not the best...
is it possible to give me an example how to extract the "comments link"?

Thank you very much

narres’s picture

Copy&Paste this code to the beginning of your node.tpl.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[^>]+>'.t('read more').'</a>!', '', $links);
  $readmore = '<span class="readmore">'. $match[0] . '</span>';
}
else {
  $readmore = '<span class="readmore-fill"></span>';
}
// *** Extract "add new comment" link from $links so we can display it separately.
if (preg_match('!<a[^>]+>'.t('add new comment').'</a>!', $links, $match)) {
  $links = preg_replace('!\| <a[^>]+>'.t('add new comment').'</a>!', '', $links);
  $comment = '<span class="comment">'. $match[0] . '</span>';
}
else {
  $comment = '<span class="comment-fill"></span>';
}

Replace the part in your node.tpl.php where something like:
print $submitted
by:
print $submitted." | ".$comment

The two extract-snippets are deleting the two parts (comment & readmore link) from $links and stores them into $comment and $readmore.

Thomas Narres
Keep the sunny side up