<?php $posts = $this->getPosts(); ?>
<div id="messages_product_view">
    <?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?>
    <?php echo Mage::app()->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
</div>

<?php echo $this->getChildHtml('magentothem_blog_comments_toolbar'); ?>
<?php foreach ($posts as $post): ?>
    <div class="postWrapper">
        <div class="postTitle">
            <h2><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle(); ?></a></h2>
            <h3><?php echo $post->getCreatedTime(); ?></h3>
        </div>
        <div class="postContent"><?php echo $post->getPostContent(); ?></div>

        <?php echo $this->getBookmarkHtml($post) ?>
        <div class="tags"><?php echo $this->getTagsHtml($post) ?></div>
        <div class="postDetails">
            <?php if ($this->getCommentsEnabled()): ?>
                <?php echo $post->getCommentCount(); ?> <a href="<?php echo $post->getAddress(); ?>#commentBox" >Comments</a> |
            <?php endif; ?>
            <?php $postCats = $post->getCats(); ?>
            <?php if (!empty($postCats)): ?>
                <?php echo Mage::helper('blog')->__('Posted in'); ?>
                <?php foreach ($postCats as $data): ?>
                    <a href="<?php echo $data['url']; ?>"><?php echo $data['title']; ?></a>
                <?php endforeach; ?>
            <?php else: ?>
                <?php echo Mage::helper('blog')->__('Posted'); ?>
            <?php endif; ?><?php echo $this->__("By"); ?> <?php echo $post->getUser(); ?></div>
    </div>
<?php endforeach; ?>
<?php echo $this->getChildHtml('magentothem_blog_comments_toolbar'); ?>
