What does comment.tpl.php do? i cant understand the theme documentation can anyone have patience to explain me with examples! please guide me through the coding part too

Comments

yelvington’s picture

comment.tpl.php formats comments. It is invoked repeatedly, once for each comment.

Unless you want to change the default presentation of comments, your template doesn't need this file. The default code is simple and obvious.

<?php
// $Id: comment.tpl.php,v 1.6 2008/01/04 19:24:24 goba Exp $
?>
<div class="comment<?php print ' '. $status; ?>">
  <?php if ($picture) : ?>
    <?php print $picture ?>
  <?php endif; ?>
  <h3 class="title"><?php print $title ?></h3>
  <div class="submitted"><?php print $submitted ?><?php if ($comment->new) : ?><span class="new"> *<?php print $new ?></span><?php endif; ?></div>
  <div class="content">
    <?php print $content ?>
    <?php if ($signature): ?>
      <div class="clear-block">
        <div>—</div>
        <?php print $signature ?>
      </div>
    <?php endif; ?>
  </div>
  <!-- BEGIN: links -->
  <div class="links">&raquo; <?php print $links ?></div>
  <!-- END: links -->
</div>

nahids29’s picture

Oh this is the default code.. we dont need to change it? hmm lemme ask.

what is &raquo?

<!-- BEGIN: links -->
  <div class="links">&raquo; <?php print $links ?></div>
  <!-- END: links -->
BladeRider’s picture

&raquo is the 'right-angle quote' HTML entity. See http://www.w3schools.com/tags/ref_entities.asp for a fuller list.

Note that it needs to end with a semi-colon - if you'd entered that missing semi-colon, you would have seen a "»" character :)

nahids29’s picture

so it just prefix the "»" character before the links is it? but it doesn't end with the semi colon there! so what will it be displayed as?

BladeRider’s picture

That's correct, it will prefix with ».

The semi-colon is there in the pasted code I've seen - is it missing from your own copy?

nahids29’s picture

Well the semi colon is there in the code u pasted and the code i pasted too.. i have no clue which semi colon u talking about