0

I'm using the Perch CMS to pull through some captions for a bxslider. I currently have 4 taglines. Because I'm using a different image on each bxslider list item I'm wondering if there's a way to pull out a specific index of the array itself.

<ul class="bxslider">
    <li> <img src="assets/img/banners/hay-banner.jpg"/> </li>
    <li> <img src="assets/img/banners/final-farmhouse-banner.jpg"/> </li>           
    <li> <img src="assets/img/banners/final-tractor-banner.jpg"/> </li>
    <li> <img src="assets/img/banners/property-owners.jpg"/> </li>
</ul>

That's my HTML code currently. And I want to be able to pull the taglines out using

<?php perch_content('Taglines');?>

But obvioulsy that will pull all of the taglines into the title and not just the first tagline for the first <li>, the second tagline for the second <li> tag.

Is there a way to do this within perch? (Ideal output below).

<li> <img src="assets/img/banners/hay-banner.jpg" title="perch_content('Taglines (1))"
WebDevDanno
  • 1,122
  • 2
  • 22
  • 50

1 Answers1

0

Create a template for that region in perch/templates/content/bxslider.html

Assuming you want the images to be rendered to 1000x400 on upload:

<perch:before>
<ul class="bxslider">
</perch:before>
    <li> <img src="<perch:content id="image" label="Image" type="image" width="1000" height="400" crop="true" />" title="<perch:content id="tagline" label="Tagline" type="text" />" /> </li>
<perch:after>
</ul>
</perch:after>

On your page, create the region with <?php perch_content('Slider'); ?>, reload the page in the browser, go to perch backend, set the now appeared region "Slider" on that page to allow multiple items and use the template "Bxslider" - Done.

Many more options for images are to be found on http://docs.grabaperch.com/docs/templates/attributes/type/image/

Urs
  • 4,984
  • 7
  • 54
  • 116