<?php   $e = $this->item;

	    if ( $p = $this->navigation()->getContainer()->findOneBy( 'ref', 'galeries' ) ) {
                    $p->addPage( new Zend_Navigation_Page_Mvc( array(
                        'label' => $this->gallery->name,
                        'module' => 'gallery',
                        'controller' => 'index',
                        'action' => 'view'
                    ) ) );
	    } 
   
$gallery = $this->gallery;

$images = $gallery->loadImages(false, false);

$Cache = Alfred_Hod::cache();
$cacheKey = 'Gallery_View_'.$gallery->id;

if(!$output = $Cache->load($cacheKey)):
    $this->placeholder('output')->captureStart();
        ?>
<div class="row gallery">
    <h1><?= $gallery->name ?></h1>
<?php foreach($images as $image) : ?>
    <div class="col-xs-6 col-sm-4 col-md-3">
        <?= $this->image( $image->getOriginal(), array('preset'=>'large','alt'=> $image->name,'html'=> true, 'lightbox'=>true, 'tnpreset' => 'small') ) ?>
    </div>
<?php endforeach; ?> 
</div>
<?php
$this->placeholder('output')->captureEnd();
    $output = $this->placeholder('output');
    $Cache->save($output,$cacheKey,array('gallery','gallery_galleries','gallery_images'));

endif; // cahche
echo $output;
