<div class="we_content_block we_post">
<?php
if (isset($_GET['action']))
{
$msg = '';
if ($_GET['action'] == 'ok')
{
$msg = 'Thank you for your comment.';
if (isset($_GET['spec']) && $_GET['spec'] == 'review')
$msg .= '<br />After your comment has been reviewed, it will be visible.';
echo "<p class='we_msg_ok'>$msg</p>";
}
}
$tags = get_tags($GLOBALS['we_collectionitem']);
echo '<h1>' . $GLOBALS['we_collectionitem']->title . '</h1>';
echo $GLOBALS['we_collectionitem']->content1 . '<div id="more-' . $GLOBALS['we_collectionitem']->id . '">' . $GLOBALS['we_collectionitem']->content2 . '</div>';
echo '<div class="we_meta">';
echo '<span>' . $tags . '</span> | <span>' . $GLOBALS['we_collectionitem']->date_created . '</span>';
if ($GLOBALS['we_collection']->has_comments)
echo ' | <span><a href="#comments">Comments (' . count($GLOBALS['we_comments']) . ')</a></span>';
echo '</div>';
echo '</div>';
$now = time();
$created = strtotime($GLOBALS['we_collectionitem']->date_created);
$alive_until = $created + ($GLOBALS['we_collection']->comments_days_active * 24 * 60 * 60);
if ($GLOBALS['we_collection']->has_comments)
{
echo '<div class="we_content_block we_comments" id="comments"><h2>Comments</h2>';
if (!empty($GLOBALS['we_comments']))
{
$odd = true;
foreach ($GLOBALS['we_comments'] as $comment)
{
$oddClass = $odd ? 'we_odd' : 'we_even';
//echo "<div class='we_comment' id='comment_$comment->id'><span class='metacomment'>$comment->name wrote on $comment->dateCreated</span><p>$comment->comment</p></div>";
echo '<div class="we_comment_block ' . $oddClass . '">';
echo '<div class="we_comment_meta"><strong>' . $comment->name . '</strong> wrote on ' . $comment->dateCreated . '</div>';
echo '<p class="we_comment">' . $comment->comment . '</p>';
echo '</div>';
$odd = !$odd;
}
}
else
{
echo '<div class="we_meta"><em>No comments.</em></div>';
}
echo '</div>';
//
if ($alive_until < $now)
{
echo '<div class="we_meta"><em>Comments are turned off after ' . $GLOBALS['we_collection']->comments_days_active . ' days.</em></div>';
}
else if ($GLOBALS['we_collectionitem']->comments_closed)
{
echo '<div class="we_meta"><em>Comments are closed.</em></div>';
}
else
{
?>
<div class="we_content_block we_commentform">
<h2>Make a comment</h2>
<form name="commentForm" id="commentForm" action="<?php echo WE_PATH_SUB; ?>/webessence/comment.php" method="post">
<p><label for="name">Name (required)</label><br />
<input type="text" name="name" id="name" maxlength="60" /></p>
<p><label for="url">Website</label><br />
<input type="text" name="url" id="url" maxlength="60" /></p>
<p><label for="email">Email (required, will never be published)</label><br />
<input type="text" name="email" id="email" maxlength="60" /></p>
<p><label for="comment">Comment (required)</label><br />
<textarea name="comment" id="comment"></textarea></p>
<input type="hidden" name="itemid" value="<?php echo $GLOBALS['we_collectionitem']->id; ?>" />
<p><input type="submit" value="Submit" /></p>
</form>
</div>
<?php
}
}
?>