Forum Discussion

kentgilliam's avatar
12 years ago

Need "if/then if both then X" conditional

I am trying to add a new product group to our Lithium platform but I need to have different headers for it from our regular community. I know I can easily (not really) do this by creating pages for each page this other product group will build but that's a ton. What I'd like to do is just have a Custom Component with a conditional where if the person is a member of one role it will show one header but if they are a member of another role it will show another but if they are a member of both then show only one header. I know how to do the conditional like this:

 

<#assign user_has_role = false /> 
<#if user.registered > 
<#list restadmin("/users/id/${user.id?c}/roles").roles.role as role> 
<#if role.name?? && (role.name == "BBCRM")> 
<#assign user_has_role = true /> 
</#if> 
</#list> 
</#if> 

<#if user_has_role > 

<@component id="Pages.Header.BBCRM"/> 

<#else> 

<@component id="Pages.header.bb"/> 

</#if> 

 But I keep getting this error:

 

Freemarker template 'preview' processing failed: 
RenderQueueException:Render queue error in BeginRender[components/ComponentDisplayContributionPage:componentdisplay0]: unknown component id: Pages.header.bb

 

My page "header.bb" is a page made up from a quilt of different custom components. Is this why it won't recognize the "header.bb" page, because it's not a core page like ForumPage or something like that? If so, what the heck good is it to be able to embed a core component?

 

Thanks for any help anyone can give!

 

Kent

 

 

 

 

 

2 Replies

  • VenkS's avatar
    VenkS
    Lithium Alumni (Retired)
    12 years ago

    Instead of "Pages.", try "quilt:" (Example, "quilt:Header"). You might also need to make sure that your Page is nestable (this option can be set in the Page Editor).

     

    Hope that helps!

  • Thanks guys. I got it to work. I actually created a custom component for each element and then pulled them into the one conditional page. I'll try the "quilt:header" option and see if that makes it easier to manage.

     

    Thanks for the feedback!