Forum

Thread tagged as: Question, Problem, Configuration

How do I add different classes to images using one content file

How do I show a group of images using one image content file but with each image having a different div.class. Is that possible or should I be doing it a different way?

Perch Runway: 3.0.5, PHP: 7.1.5, MySQL: 10.0.30-MariaDB, with PDO
Server OS: Linux, litespeed
Installed apps: content (3.0.5), assets (3.0.5), categories (3.0.5), perch_blog (5.5.1), perch_forms (1.9), perch_gallery (2.8.9), perch_kraken (1.1), chirp_seo (1), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_gallery', 'perch_mailchimp', 'chirp_seo', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/robertsd/public_html/perch
PERCH_CORE: /home/robertsd/public_html/perch/core
PERCH_RESFILEPATH: /home/robertsd/public_html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 256M, Max POST 32M, Memory: 256M, Total max file upload: 32M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
HTTP_HOST: robertsdesign.biz
DOCUMENT_ROOT: /home/robertsd/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
David Roberts

David Roberts 0 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

What HTML are you trying to end up with?

Four images in a row.

<div class="intro-images">
<div class="image-1"></div>
<div class="image-2"></div>
<div class="image-3"></div>
<div class="image-4"></div>
</div>
Rachel Andrew

Rachel Andrew 394 points
Perch Support

In a Repeater you could have a selection for the class.

Or, you could use perch_item_index to add the number onto the end of the classname (if it really is image-1, -2 etc. that you want).

However I'd just target them with CSS and not add a class at all, using the nth-child selector.