How could I style the "reply" link in comment.tpl.php?

I have this line of code inside:

<?php print render($content['links']) ?>

With this I get something like the following:

<ul class="links inline" thmr="thmr_249"><li class="comment-reply first last"><a href="/?q=comment/reply/28/1" thmr="thmr_250 thmr_251">reply</a></li></ul>

I manage to get the exact URL with <?php print render($content['links']['comment']['#links']['comment-reply']['href']) ?>, but for some reason it doesn't work perfectly: It loses the "/?q=" part.


Just use the following code:

<?php print url($content['links']['comment']['#links']['comment-reply']['href']); ?>

If you pass node/1 to url(), it will return /?q=node/1 when clean URLs are not enabled, and /node/1 when clean URL are enabled.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.