Skip to content

Instantly share code, notes, and snippets.

@xcommerce-gists
Created January 21, 2014 19:16
Show Gist options
  • Save xcommerce-gists/8546370 to your computer and use it in GitHub Desktop.
Save xcommerce-gists/8546370 to your computer and use it in GitHub Desktop.
Sample Magento template for the news article list view
<?php
/**
* News template for items list
*
* @author Magento
*/
/**
* @var $this Magentostudy_News_Block_List
* @see Magentostudy_News_Block_List
*/
?>
<div id="news_list_messages"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="page-title">
<h1><?php echo Mage::helper('magentostudy_news')->__('Site News') ?></h1>
</div>
<div class="news_list_view">
<?php foreach ($this->getCollection() as $newsItem): ?>
<div id="item_<?php echo $newsItem->getId() ?>" class="news_list_item">
<h2>
<a href="<?php echo $this->getItemUrl($newsItem) ?>">
<?php echo $this->escapeHtml($newsItem->getTitle()) ?>
</a>
</h2>
<div class="news_item_subtitle">
<?php echo $this->formatDate($newsItem->getTimePublished(), 'medium') ?> |
<?php echo $this->escapeHtml($newsItem->getAuthor()) ?>
</div>
<?php if ($imageUrl = $this->getImageUrl($newsItem, 100)): ?>
<p><img src="<?php echo $imageUrl ?>" alt="<?php echo $this->escapeHtml($newsItem->getTitle()); ?>" /></p>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php echo $this->getPager() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment