Forum

Thread tagged as: Question, Gallery

Gallery inside a block

I would like my editors to be able to insert a gallery in their pages by selecting from a dropdown in the admin which contains a list of all created galleries.

So far I have a gallery set up and working as per the instructions here: https://docs.grabaperch.com/video/v/gallery-a-simple-portfolio/

Next I want to move out this code so it can be put into the pages only when required:

<?php perch_gallery_album_images("my-gallery", array( 'template'=>'album-image.html' )); ?>

I've added the album-image template to my group of blocks:

<perch:blocks>

    <perch:block label="Quote" type="quote">
        <perch:template path="content/blocks/quote.html" />
    </perch:block>

    <perch:block label="Image and Text" type="image-and-text">
        <perch:template path="content/programs/image_and_text.html" />
    </perch:block>

    <perch:block label="Image full size" type="image-fullsize">
        <perch:template path="content/blocks/image_fullsize.html" />
    </perch:block>

    <perch:block label="Gallery" type="gallery">
        <perch:template path="content/gallery/album-image.html" />
    </perch:block>

</perch:blocks>

In album-image.html I still have the content learnt from the tutorial:

<perch:before>
<div class="clear gallery">
    <div class="wrap wrap--medium">
        <h2>Gallery</h2>
        <ul class="list gallery__list">
</perch:before>
        <li><a class="fancybox" rel="group" href="<perch:gallery id="main" />"><img src="<perch:gallery id="small" />" alt=""></a></li>
<perch:after>
        </ul>
    </div>
</div>
</perch:after>

So now I guess I'm just a bit lost as to how to continue. Please help!

Stephen Turvey

Stephen Turvey 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think you're going to be able to do that with blocks. Not simply, at least.