Forum

Thread tagged as: Question

Content that can be selected

Hi,

I am building a supplier listing page. Each supplier may have up to four accreditation logos.

Each supplier listing uses a perch template.

Is there a way to have each of these four logos so that they are only uploaded once and then either selected or not selected in the page editor, thus controlling if they display or not?

The alternative would be to upload the relevant images for every supplier which would be quite time consuming.

Hope that makes sense!

Thanks in advance for your help.

Christian

Christian Thomas

Christian Thomas 0 points

  • 7 years ago

I would upload the logos manually to your site and then write your template to include them with standard img tags based on the selection from a drop down option field type. You might want to use repeaters so that you can pick how many logos to add to each.

Alternatively Perch 2.5 out soon hopefully, will include image assets to save uploading the same logos over and over.

I had a go at the way I suggested and it seems to work. Here is the template I created:

<perch:content id="title" type="text" label="Supplier Name" required="true" title="true" />
<perch:content id="description" type="textarea" label="Supplier Description" markdown="true" editor="markitup" />


<perch:repeater id="images" label="Images" max="4">
    <perch:before><ul></perch:before>
    <li>
        <img src="../images/<perch:content id="logo" type="select" label="accreditation logos" 
options="logo1, logo2, logo3, logo4" allowempty="false" required="true" />.png" 
          />
    </li>
    <perch:after></ul></perch:after>
</perch:repeater>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Perch 2.5 will be out this week, and that includes asset reuse.