0

I am using the following code to display an inline list of regions from a categories list for a product entry. The backspace isn't working at all, no matter how I change my code around. I will post a couple of the combinations I tried. Any ideas?

<ul>
    <li><p>Region: 
    {categories show_group="9" style="linear" backspace="7"}
        <a href="{path=/products}">{category_name}</a>,&nbsp;
    {/categories}
    </p></li>
</ul>

as well as

<ul>
    <li><p>Region: 
    {categories show_group="9" style="linear" backspace="7"}
        <a href="{path=/products}">{category_name},&nbsp;</a>
    {/categories}
    </p></li>
</ul>

and this one with a , and regular space afterwards

<ul>
    <li><p>Region: 
    {categories show_group="9" style="linear" backspace="2"}
        <a href="{path=/products}">{category_name}</a>, 
    {/categories}
    </p></li>
</ul>

I've read a few posts on the ellislabs forums related to this...which is why I have a few combinations, but nothing is working. I am using EE 2.6.1.

2
  • 1
    The backspace count includes whitespace, have you accounted for that? – Kevin Cupp Sep 11 '13 at 18:38
  • Kevin is right, the spaces and line returns count. Move the closing categories tag just after that anchor and you should be all set. – Nuno Albuquerque Sep 11 '13 at 19:01
1

It turns out whitespace and placement of the closing categories tag was the issue. I moved the whole tag group onto 1 line in my template, and moved the , and closing categories tag outside of the closing </a> tag. Thanks Kevin and Nuno! I added a span so I could color the commas the same as the links.

<ul>
    <li><p>Region: 
        <span>{categories show_group="9" backspace="2"}<a href="{path=/products}">{category_name}</a>, {/categories}</span>
    </p></li>
</ul>

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.