Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created January 21, 2014 19:17
Show Gist options
  • Save xcommerce-gists/8546383 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/8546383 to your computer and use it in GitHub Desktop.
Sample Magento template to display an individual news article
<?php
/**
* News template for separate item
*
* @author Magento
*/
/**
* @var $this Magentostudy_News_Block_Item
* @see Magentostudy_News_Block_Item
*/
?>
<?php $_newsItem = $this->helper('magentostudy_news')->getNewsItemInstance(); ?>
<div id="news_item_messages"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="page-title">
<h1><?php echo $this->escapeHtml($_newsItem->getTitle()) ?></h1>
<div class="news_item_subtitle">
<?php echo $this->formatDate($_newsItem->getTimePublished(), Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM) ?> |
<?php echo $this->escapeHtml($_newsItem->getAuthor()) ?>
</div>
</div>
<div class="news_item_view">
<?php if ($imageUrl = $this->getImageUrl($_newsItem, 400)): ?>
<p><img src="<?php echo $imageUrl ?>" alt="<?php echo $this->escapeHtml($_newsItem->getTitle()) ?>" /></p>
<?php endif; ?>
<div class="news_item_content"><?php echo $_newsItem->getContent() ?></div>
<div class="pager">
<a href="<?php echo $this->getBackUrl() ?>">
<?php echo Mage::helper('magentostudy_news')->__('Return to list') ?>
</a>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment