1

I have a series of entries coming from a Matrix field on a page. If there is more than one entry I would like a "+" to follow each entry, except for the final entry. I've tried using backspace, but that removes the "+" from all entries.

<h2>
{artists}
{if performance_type == "Performance"}
{artist}<a href="{title_permalink="artists/view"}">{title}</a>
{if total_results >= "1"}&nbsp;+&nbsp;{/if}
{/artist}
{/if}
{/artists}
</h2>

Any ideas at all would be greatly appreciated. Thank you!

3

I think the best way achieve this is to do by adding CSS. For that you just need to create one class pipe containing the + sign (either with an image or with color). Then put that pipe class on respected rows in Matrix. This way you can manage it very easily.

span.pipe:before {content:" + ";}
span.pipe:first-child:before {display: none;}
| improve this answer | |
  • That's a great approach, thank you for the input! – Matt Jul 12 '18 at 17:48
1

if you change this

{if total_results >= "1"}&nbsp;+&nbsp;{/if}

to this

{if count != total_results}&nbsp;+&nbsp;{/if}

Then you will get the "+" if there are multiple and it will not put the "+" at the end.

| 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.