Gallery with just one thumb

From Contao Community Documentation

Revision as of 00:58, 23 November 2013 by Andreas (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Applies to
Contao version all versions


Even though it's for all versions a slightly modification might be necessary for versions below Contao 3.2.0.

"Warning"


Gallery with just one thumb

Goal

A FE gallery with one thumb and the possibility to navigate all pics in a lightbox. Javascript has to be enabled.

Realization

You have to use a modified version of template gallery_default.html5.

Template

Here's the template gallery_single_image.html5. On XHTML-output figure has to be replaced with div.

<?php
 
/**
 * @filename gallery_single_image
 * @version Contao 3.2.0
 * @license LGPL
 * @description A gallery template that only loads the first thumb but shows all pics in mediabox or colorbox.
                Check 'Full-size view/new window' in your gallery.
                Don't forget to load moo_mediabox or j_colorbox in your layout.
 */
 
?>
 
<div class="gallery-single-image">
<?php $i = 1; foreach ($this->body as $class=>$row): ?>
<?php foreach ($row as $col): ?>
<?php if ($col->addImage): ?>
<?php if ($i == 1): ?>
<figure class="image_container">
<?php endif; ?>
<?php if ($col->href): ?>
<a href="<?php echo $col->href; ?>"<?php echo $col->attributes; ?> title="<?php echo $col->alt; ?>"><?php if ($i == 1): ?><img src="<?php echo $col->src; ?>"<?php echo $col->imgSize; ?> alt="<?php echo $col->alt; ?>"><?php endif; ?></a>
<?php endif; ?>
<?php if ($i == 1): ?>
</figure>
<?php endif; ?>
<?php endif; ?>
<?php $i++; endforeach; ?>
<?php endforeach; ?>
</div>

--Andreas Burg 00:58, 23 November 2013 (CET)

Views
Personal tools

Contao Community Documentation

In other languages
Navigation
Discover
Understand
Enhance
Miscellaneous
Tools