Skip to content

Instantly share code, notes, and snippets.

@St0iK
Created September 24, 2015 09:52
Show Gist options
  • Save St0iK/3d3effd00aac9a9f1da1 to your computer and use it in GitHub Desktop.
Save St0iK/3d3effd00aac9a9f1da1 to your computer and use it in GitHub Desktop.
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package base_default
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
function truncate($phrase, $max_words) {
$phrase_array = explode(' ',$phrase);
if(count($phrase_array) > $max_words && $max_words > 0)
$phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...';
return $phrase;
}
?>
<?php
/**
* Category view template
*
* @see Mage_Catalog_Block_Category_View
*/
?>
<?php
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
$_imgHtml = '';
if ($_imgUrl = $_category->getImageUrl()) {
$_imgHtml = '<p class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></p>';
$_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
}
?>
<?php $_enableTitle = $this->getCurrentCategory()->getEnable_disable_title(); ?>
<?php if(!$_enableTitle): ?>
<div class="page-title category-title">
<?php if($this->IsRssCatalogEnable() && $this->IsTopCategory()): ?>
<a href="<?php echo $this->getRssLink() ?>" class="link-rss"><?php echo $this->__('Subscribe to RSS Feed') ?></a>
<?php endif; ?>
<h1><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
</div>
<?php endif; ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php if($_imgUrl): ?>
<?php echo $_imgHtml ?>
<?php endif; ?>
<?php if($this->isContentMode()): ?>
<div class="cat-cms-description">
<?php echo $this->getCmsBlockHtml() ?>
</div>
<?php elseif($this->isMixedMode()): ?>
<div class="cat-cms-description">
<?php echo $this->getCmsBlockHtml() ?>
</div>
<?php echo $this->getProductListHtml() ?>
<?php else: ?>
<?php echo $this->getProductListHtml() ?>
<?php endif; ?>
<?php
$seo_title =$this->getCurrentCategory()->getSeoTitle();
$seo_description =$this->getCurrentCategory()->getSeoText();
$category_description = $this->getCurrentCategory()->getDescription();
?>
<?php if($category_description ): ?>
<div class="category-description std">
<div class="cat-desc-content">
<?php echo $category_description; ?>
</div>
</div>
<?php endif; ?>
<?php
$collection = Mage::getModel('blog/blog')->getCollection()
->addPresentFilter()
->addStoreFilter(Mage::app()->getStore()->getId())
->setOrder('created_time ', 'desc');
Mage::getSingleton('blog/status')->addEnabledFilterToCollection($collection);
$collection->setPageSize(1);
$collection->setCurPage(1);
?>
<div class="blog-container">
<?php foreach ($collection as $post) :?>
<a href="/blog/" class="blog-teaser">
<div class="blog-feature-image">
<img src="/skin/frontend/myfirstyears/default/images/sprite/blog-features.png" alt="Baby Blog Features" />
</div>
</a>
<?php endforeach;?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment