We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Taxonomy and EE - is it possible to use `{switch}` inside taxonomy's tags?

How Do I?

Andy @ Pillory Barn's avatar
Andy @ Pillory Barn
130 posts
9 years ago
Andy @ Pillory Barn's avatar Andy @ Pillory Barn

I am using ExpressionEngine 2.10.3 and also Taxonomy 3 plugin. I have the following code which, when run, returns the 15 nodes I have set up:

<div class="col-md-4">
    {exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
        <li>
            <a href="http://{node_url}">{node_title}</a>
        </li>
    {/exp:taxonomy:nav}
</div>

What I would like to do is after every 5 entries, end the current <div> and start a new col-md-4. Usually, I would use {switch} and I have tried it like this:

<div class="col-md-4">
    {exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
        <li>
            <a href="http://{node_url}">{node_title}</a>
        </li>
        {switch='||||</div><div class="col-md-4">'}
    {/exp:taxonomy:nav}
</div>

But it doesn’t work at all, instead it just prints out {switch='||||'}

Is there any way of doing what I’m trying to do?

Thanks in advance, Andy

       
Pedro Guimaraes's avatar
Pedro Guimaraes
170 posts
9 years ago
Pedro Guimaraes's avatar Pedro Guimaraes

Here’s a solution to your problem. Replace switch with this:

{if count % 5 == 0}</div><div class="col-md-4">{/if}

See Conditional Tags for more info.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.