Forum Discussion

JillianB's avatar
JillianB
Genius
11 years ago

How do I use two <#if> in a component?

I'm currently using an <#if> in my component to show one image if the corenodeID is a certain group and another image is anything else. I now need to complicate things and add in another <#if> to show another image, but I can't seem to figure out how to make it work. Adding in another <#if> leaves it open, but closing it causes all sorts of bizzarre issues such as two logos showing up on certain pages and none on others.

 

Any ideas on how to make this work? And yes, I'm a total newbie at coding. :smileyembarrassed:

 

Thank you!

  

<#if coreNode.id?? && ((coreNode.id == "Instructor") || (coreNode.id == "Income") || (coreNode.id == "BlockWorksIC") || (coreNode.id == "TTSVirtual") || (coreNode.id == "Skills") || (coreNode.id == "FTF") || (coreNode.id == "BestPractices") || (coreNode.id == "Resources"))> 
<div class='VIC_community_logo'>
    <a href="/t5/Instructor-Community/ct-p/Instructor" class="VICcommunityLogo" title="Virtual Instructor Community">Virtual Instructor Community</a>
  <span class="tagline">Collaborating for success.</span>
</div>

<#if coreNode.id?? && ((coreNode.id == "BlockWorks") || (coreNode.id == "PersonalRet") || (coreNode.id == "Training") || (coreNode.id == "BusinessRet") || (coreNode.id == "BWResources"))> 
<div class='VIC_community_logo'>
    <a href="/t5/BlockWorks/ct-p/BlockWorks" class="BWcommunityLogo" title="BlockWorks District Advocate Community">Blockworks District Advocate Community</a>
  <span class="tagline">Collaborating for success.</span>
</div>

<#else>
<div class='hrb_community_logo'>
      <a href="/" class="communityLogo" title="The Community">The Community</a>
  <span class="tagline">Looking at life through tax.</span>
</div>

</#if>
</#if>

  

 

 

  • JillianB - Please try the code, I have made some changes to it and used elseif instead of your second if condition.

     

     

    <#if coreNode.id?? && ((coreNode.id == "Instructor") || (coreNode.id == "Income") || (coreNode.id == "BlockWorksIC") || (coreNode.id == "TTSVirtual") || (coreNode.id == "Skills") || (coreNode.id == "FTF") || (coreNode.id == "BestPractices") || (coreNode.id == "Resources"))> 

    <div class='VIC_community_logo'>
    <a href="/t5/Instructor-Community/ct-p/Instructor" class="VICcommunityLogo" title="Virtual Instructor Community">Virtual Instructor Community</a>
    <span class="tagline">Collaborating for success.</span>
    </div>
    <#elseif coreNode.id?? && ((coreNode.id == "BlockWorks") || (coreNode.id == "PersonalRet") || (coreNode.id == "Training") || (coreNode.id == "BusinessRet") || (coreNode.id == "BWResources"))>
    <div class='VIC_community_logo'>
    <a href="/t5/BlockWorks/ct-p/BlockWorks" class="BWcommunityLogo" title="BlockWorks District Advocate Community">Blockworks District Advocate Community</a>
    <span class="tagline">Collaborating for success.</span>
    </div>
    <#else>
    <div class='hrb_community_logo'>
    <a href="/" class="communityLogo" title="The Community">The Community</a>
    <span class="tagline">Looking at life through tax.</span>
    </div>
    </#if>

     

     

    Let me know if this helps. Also refer to this documentation here.

  • JillianB - Please try the code, I have made some changes to it and used elseif instead of your second if condition.

     

     

    <#if coreNode.id?? && ((coreNode.id == "Instructor") || (coreNode.id == "Income") || (coreNode.id == "BlockWorksIC") || (coreNode.id == "TTSVirtual") || (coreNode.id == "Skills") || (coreNode.id == "FTF") || (coreNode.id == "BestPractices") || (coreNode.id == "Resources"))> 

    <div class='VIC_community_logo'>
    <a href="/t5/Instructor-Community/ct-p/Instructor" class="VICcommunityLogo" title="Virtual Instructor Community">Virtual Instructor Community</a>
    <span class="tagline">Collaborating for success.</span>
    </div>
    <#elseif coreNode.id?? && ((coreNode.id == "BlockWorks") || (coreNode.id == "PersonalRet") || (coreNode.id == "Training") || (coreNode.id == "BusinessRet") || (coreNode.id == "BWResources"))>
    <div class='VIC_community_logo'>
    <a href="/t5/BlockWorks/ct-p/BlockWorks" class="BWcommunityLogo" title="BlockWorks District Advocate Community">Blockworks District Advocate Community</a>
    <span class="tagline">Collaborating for success.</span>
    </div>
    <#else>
    <div class='hrb_community_logo'>
    <a href="/" class="communityLogo" title="The Community">The Community</a>
    <span class="tagline">Looking at life through tax.</span>
    </div>
    </#if>

     

     

    Let me know if this helps. Also refer to this documentation here.

    • JillianB's avatar
      JillianB
      Genius
      Thank you, both! #elseif worked perfectly and I'm glad to know about that now!

      Thank you SO much!
  • #elseif

     

    Or maybe I misunderstand your question.