The comments.php script contains a list of comments related to a gived article and
a form to submit new comments. All the logic to submit new comments is ready
to be used. All you need to do is just create the form.
Accessible data:
An example of code:
<h2>
<?= $this->article->getTitle(); ?>
</h2>
<div class="date"><?= $this->article->getCreatedFormatted() ?> by
<?
foreach ($this->article->users() as $user) {
echo $user->getName().' ';
}
?>
</div>
<div class="entry">
<?= $this->article->getSummary() ?>
</div>
<h3>Comments</h3>
<?
if (isset($this->advice)) {
echo '<b>'.$this->advice.'</b>';
}
?>
<? foreach($this->article->commentsPublished() as $comment) { ?>
<div class="date"><?= $comment->getCreatedFormatted() ?> by
<?= $comment->getSignature() ?>
</div>
<div class="entry">
<?= $comment->getTitle() ?>
<?= $comment->getBody() ?>
</div>
<? } ?>
<? if ($this->article->getCommentsallowed() && $this->article->number()->getCommentsallowed()): ?>
<p>
<form name="newcomment" method="post" action="<?= URIMaker::comment($this->article) ?>">
Title
<input type="text" name="Title" value=""/>
Body
<textarea name="Body" rows="4" cols="40">
Signature
<input type="text" name="Signature" value=""/>
<img src="<?= URIMaker::fromBasePath('lib/securimage/securimage_show.php?sid='.md5(uniqid(time())))?>">
<input type="text" name="code" />
<input type="submit" value="Ok" name="Ok" />
</form>
</p>
<? endif; ?>
The fields name (Title, Body, Signature) is a constrain.