Composr Supplementary: Converting a Composr Gallery to a Carousel

Written by Steve Jarvis and Chris Graham, Sponsored by Arvixe hosting
Image

The main_gallery_embed block in the Block construction assistant

The <kbd>main_gallery_embed</kbd> block in the Block construction assistant

(Click to enlarge)

A task which I do on most sites I build with Composr is to add a carousel interface to my galleries. Thankfully in Composr this is a simple task which doesn't require any programming knowledge.

All you need to do to display a carousel gallery on one of your pages is to add the main_gallery_embed with a guid parameter of carousel.

If you are using the Block construction assistant you will need to fill in the form which has the following options:
  • Param – Choose the Gallery you wish to display from the dropdown list
  • Select – You can choose to only display specifically numbered photo's or if you leave it blank it will display all of them
  • Videos – If there are videos in the gallery you can choose specific videos to display
  • Max – the maximum number of entries to display
  • Title – The Title of the block
  • Sort – Which order do you want the pictures to display. This could be things like date ascending, highest rating first, random etc
  • Days – If you have a gallery which has new items added you may choose to only display photo's added in the last X number of days
  • Show if empty – Tick this

Then you need to expand the advanced block parameters, and set the GUID value. It has to be exactly carousel.

That's it! This feature works because the default BLOCK_MAIN_GALLERY_EMBED.tpl template is coded to have a carousel display option via this GUID. In general GUID values allow templates to render differently in different situations, because the templates can look at the values and adjust themselves accordingly. Usually this only happens when you the themer explicitly codes this in, but this block is a rare case where we have a different layout style out-of-the-box.

Feedback

Please rate this tutorial:

Have a suggestion? Report an issue on the tracker.