Forum

Thread tagged as: Question, Problem

Multiple DIV ID's and Image Links

I have a page with multiple images that need to have a "prettyPhoto" link added. How do I create an image with a link?

My TEMPLATE code looks like this:

<div class="span3 element category01" data-category="category01">
    <div class="hover_img">
        <img src="<perch:content id="perch_item_index" type="image" label="Logo" />" alt="<perch:content id="imagealt" type="text" label="Alt text" />" />
        <span class="portfolio_zoom"><a href="<perch:content id="perch_item_index" type="text" label="imageid"/>" rel="prettyPhoto[portfolio1]"></a></span>
    </div> 
</div>

The standard HTML is like this:

<div class="span3 element category01" data-category="category01">
    <div class="hover_img">
        <img src="img/portfolio/1.jpg" alt="" />
        <span class="portfolio_zoom"><a href="img/portfolio/1.jpg" rel="prettyPhoto[portfolio1]"></a></span>
    </div> 
</div>

I'm sort of lost to know how to create a unique element id for each image.

Any pointers in the right direction would be great. :)

Steve Counsell

Steve Counsell 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Change:

<div class="span3 element category01" data-category="category01">
    <div class="hover_img">
        <img src="<perch:content id="perch_item_index" type="image" label="Logo" />" alt="<perch:content id="imagealt" type="text" label="Alt text" />" />
        <span class="portfolio_zoom"><a href="<perch:content id="perch_item_index" type="text" label="imageid"/>" rel="prettyPhoto[portfolio1]"></a></span>
    </div> 
</div>

to:

<div class="span3 element category01" data-category="category01">
    <div class="hover_img">
        <img src="<perch:content id="logo" type="image" label="Logo" />" alt="<perch:content id="imagealt" type="text" label="Alt text" />" />
        <span class="portfolio_zoom"><a href="<perch:content id="logo" type="image" label="Logo" />" rel="prettyPhoto[portfolio1]"></a></span>
    </div> 
</div>

Hey Drew, Your'e a star!

Works a treat. - https://landrscaffolding.com/our-scaffolding-work.php

Thank you so much.

Steve