Home> FAQ> What is a Collection?> Testimony and Testimonies page

Testimony and Testimonies page

We recently had a customer ask for a custom collection where they could show testimonies for their service. They wanted a customer image, their message, and a page for English and another page for Spanish testimonies.

 

We created a custom collection with the html identifier: testimony. We had an image "image" and their message "testimony" fields. We also had a "language" field that could contain "English" or "Spanish" as dropdown options.

 

For the home page, we show one testimony with this code:

<style>
table, th, td {
    border: 0px;
    border-collapse: collapse;
}
.communityEvents {
    min-height: 20px;
    padding: 5px;
    margin-bottom: 20px;
    background-color: #f1f1f1;
}
</style>
<table style="width:100%">
    <tr>
        <th width="20%">Image</th>
        <th width="70%">Testimony</th> 
    </tr>
{% set item = random(su.collection( "testimony" ).language("English")) %}

     <tr style="padding:5px">
        <td width="20%"><img  data-cke-saved-src="{{ item.image }}" src="{{ item.image }}"></td>
        <td width="70%">{{ item.testimony }}</td>
              </div>
            </div>
        </td>
    </tr>
</table>

 

And for the English testimonies page, we have this code:

<style>
table, th, td {
    border: 0px;
    border-collapse: collapse;
}
.communityEvents {
    min-height: 20px;
    padding: 5px;
    margin-bottom: 20px;
    background-color: #f1f1f1;
}
</style>
<table style="width:100%">
    <tr>
        <th width="20%">Image</th>
        <th width="70%">Testimony</th> 
    </tr>
{% for item in su.collection( "testimony" ).language("English") %}

     <tr style="padding:5px">
        <td width="20%"><img  data-cke-saved-src="{{ item.image }}" src="{{ item.image }}"></td>
        <td width="70%">{{ item.testimony }}</td>
              </div>
            </div>
        </td>
    </tr>
{% endfor %}
</table>