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?

  • What's the Low Variables variable type? – Low Mar 26 '14 at 20:01
  • Matrix. It consists of 2 columns: an image and a link – Niall Thompson Mar 26 '14 at 20:24
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"
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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