1

On the home page of a site I am displaying a series of articles. In between each of these articles I wish to display a banner ad controlled via Low Variables.

At the moment it repeats the first ad between each channel entry instead of correctly looping through the banner ads.

Here is what I have so far:

{exp:channel:entries channel="articles" limit="14" disable="categories|category-fields|member-data"}

<article>
<p>{article_subtitle}</p>
<h1><a href="{title_permalink='articles/view'}">{title}</a></h1>
<figure><a href="{title_permalink='articles/view'}">
{article_images cover_only="yes"}
<img src="{image:url:large}" alt="{image:title}" />
{/article_images}
</a></figure>
<p>Lorem Ipsum</p>
<a href="{title_permalink='articles/view'}">Further reading +</a>
</article>


{exp:low_variables:parse var="banner_ads" multiple="yes" limit="1"}
<div class="banner-ad">
<a href="{banner_ads_link}"><img src="{banner_ads_image_desktop}" /></a>
</div>
{/exp:low_variables:parse}

{/exp:channel:entries}

Any thoughts?

2
  • What's the Low Variables variable type?
    – Low
    Mar 26, 2014 at 20:01
  • Matrix. It consists of 2 columns: an image and a link Mar 26, 2014 at 20:24

1 Answer 1

2

You might be able to do this with the help of Math:

{exp:low_variables:parse
    var="banner_ads"
    offset="{exp:math formula='{count}-1'}"
    limit="1"
    parse="inward"
}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.