0

I'm very new to EE but I can't seem to find how to check if the following is returning empty nodes:

{exp:taxonomy:nav tree_id="1" display_root="no" ul_css_class="clearfix"  root_node_entry_id="{entry_id}"}
    <a href="{node_url}">{node_title}</a>
{/exp:taxonomy:nav}

I'm doing this because I have a toggle button for the menu but I want to hide it if there are no children nodes for the current page.

1
  • Lily, is your desired solution on the front-end or back-end? – jrothafer Aug 4 '15 at 17:19
0

I don't know that addon at all, but have you tried a few simple conditionals? Ex:

{exp:taxonomy:nav tree_id="1" display_root="no" ul_css_class="clearfix"  root_node_entry_id="{entry_id}"}

    {if node_title != "" || node_id != ""}

        <a href="{node_url}">{node_title}</a>

    {if:else}

        <!-- empty node! -->

    {/if}

{/exp:taxonomy:nav}
2
  • ah, I apologize. I should have mentioned I needed to check if the node is empty outside of the taxonomy loop. – Lily Aug 4 '15 at 14:28
  • On the back-end or front-end? Back-end will require using github.com/croxton/Stash or turning on PHP template parsing; front-end will require some jQuery action. Please edit your question with the desired solution. – jrothafer Aug 4 '15 at 14:41
0

While in a channel:entries loop, I see if this entry is in a taxonomy tree by running this:

{if "{exp:taxonomy:get_node}{this_node_title}{/exp:taxonomy:get_node}" != ""}

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.