Forum

Thread tagged as: Question, Blog, Gallery

Blog with multiple images - or should I use a gallery

My site needs to display lists of excavators for sale, and details of each excavator. I am using Blog to enter all the excavators and to put up to 9 photos for each excavator which I want to display as a gallery within the blog listing. My post.html now allows up to 9 photos to be added, but when post.php calls <?php perch_blog_post(perch_get('s')); ?> it displays all the photos even through I have tried to suppress their display : <perch:if exists="image2"> <img src="<perch:blog id="image2" type="image" class="img-responsive" label="Image 2" />" alt="<perch:blog id="postTitle" />" suppress="true" /> </perch:if>

I want to suppress them as it seems to be easier to do the modal window gallery in post.html (although I'm having trouble getting it to recognise <perch:if exists="image2"></perch:if> etc EG : <perch:if exists="image4"> <div class="col-sm-4 col-xs-6"> <a class="gallery-box" href="<?php perch_blog_post_field(perch_get('s'), 'image'); ?>" title="UK Plant Group Excavator for Sale" data-gallery> <img src="<?php perch_blog_post_field(perch_get('s'), 'image'); ?>" class="img-responsive" alt=""/> <div class="gallery-box-caption"><div class="gallery-box-content">
<i class="icon-lg ion-ios-search"></i> </div><!-- end gallery box content --></div> <!-- end gallery box caption --> </a> </div> <!-- end col --> </perch:if>

I can send more code, but I wanted to check how I should be using Perch to handle this requirement. Would I be better setting up each excavator as a gallery rather than a blog?

Thanks!

cow shed

cow shed 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

I would use a repeater for the images, then they could add as many as they need to.

Would I do that in post.html?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

That's right, and in any other template used to output them but any tags you want to use to collect data have to be in the master template which in this case is post.html.