<div class="bread semibold">
	<a href="/">
		<i class="fa fa-arrow-circle-right"></i>
		OIL
	</a>    
	<i class="fa fa-arrow-circle-right"></i>
	Aktualności

</div>
<div class="static-content">
	<?php $locale = new Zend_Locale('pl_PL'); ?>
        
        
	<?php foreach ($this->paginator as $entry): ?>
		<div class="news-item">
			<h3><a href="<?php echo $this->url(array('id'=> $entry['id'], 'slug' => Eppe_Slugify::slugify($entry['title'])), 'news-show'); ?>"><?php echo $entry['title'] ?></a></h3>
			<div class="date">
				<?php $date = new Zend_Date(strtotime($entry['dtpublished']), false, $locale); ?>
				dodano <?php echo $date->toString('d MMMM YYYY')?>
			</div>
			<div class="news-item-short">
				<?php if ($entry['extension']): ?>
					<img src="<?php echo $this->imagesPath . $entry['id'] . '.' . $entry['extension'] ?>" class="img-left" />
				<?php endif; ?>
				<?php 
				$excerptLenght = 194;
				if(false !== $of = strpos($entry['body'], '<img')){
					$a = substr($entry['body'], $of);
					$h1 = strpos($a, 'height');
					$h2 = substr($a, $h1 + 7);
					$h1 = strpos($h2, 'px');
					$height = (int)substr($h2, 0, $h1) + 14;
					
					$w1 = strpos($a, 'width');
					$w2 = substr($a, $w1 + 6);
					$w1 = strpos($w2, 'px');
					$width = (int)substr($w2, 0, $w1) + 10;
					
					$a = round((610 - $width) / 8.6);
					$b = round(($height / 24.375));
					
					$excerptLenght += $a * $b;
				}
				?>
				<?php echo Eppe_Tools::excerptString(strip_tags($entry['body']), $excerptLenght, ' (...)') ?>
				<?php if($excerptLenght < mb_strlen($entry['body'])): ?>
					<a href="<?php echo $this->url(array('id'=> $entry['id'], 'slug' => Eppe_Slugify::slugify($entry['title'])), 'news-show'); ?>">Czytaj więcej ›</a>
				<?php endif; ?>
			</div>
		</div>
	<?php endforeach; ?>
        
        <?php echo $this->paginationControl($this->paginator,
                                    'Sliding',
                                    'pagination.phtml'); ?>
</div>