Forum Discussion

Meakii's avatar
Meakii
Contributor
7 years ago

Common widget User slide out menu in wrapper?

Hi all

 

Hoping somebody can help me. I'm wanting to use an if else conditional in the outer wrapper (in top nav bar) so that if a user isn't logged in they will see the 'register / login' button, and if they are logged in they will see their avatar and username where the 'register / login' button would have been. The issue is when I use <@component id="common.widget.slide-out-menu"/> in the wrapper (header) all pages throw up a crazy error and won't render. Effectively what I'm trying to achieve is this:

 

<#if user.anonymous == true>

<a href="#" >

<span> Register / Login</span>

</a>

<#else>

<@component id="common.widget.slide-out-user-menu"/>

</#if>

 

It's worth noting that using the @component id above works fine when in a component just not in the wrapper. And when clicked it bring the user menu slide out drawer.

Thanks in advance

 

3 Replies

  • Meakii

    You can use the following Components : 

    <#if user.anonymous>
    	<@component id="common.widget.user-navigation-modern" />
    <#else>	
    	<@component id="common.widget.slide-out-user-menu" />
    </#if>
  • Meakii's avatar
    Meakii
    Contributor
    7 years ago

    Thanks for the tip nehaSharma. sadly this doesn't work and I still receive the error. (see attached). I feel this must be something to do with being in the wrapper (Page header) rather than in a component.

  • nehaSharma's avatar
    nehaSharma
    Expert
    7 years ago

    Meakii

    You can't include these components in the Header Wrapper, you need to Create a Custom component with the code provided to you in the previous post and then include it in the Header Quilt.