Forum Discussion

tmarshall's avatar
tmarshall
Advisor
9 years ago

Community Structure - Common Pages - Localization

Hi,

 

I've been speaking with lithium gurus, and they suggest that I post my scenarios here for others to comment and get feedback about possible approaches.

 

We have two brands, purple which all the purple branding and imagery, and a second brand green, with all is branding and associated images/buttons. Our community is going to start localizing into 5 languages (German, French, Spanish ...) for both brands. What sort of structure is best and most efficient? What have others done?

 

Scenario 1 - Language(s) -> Brand(s)

A problem we have found is that if we structure by Language -> Purple Brand and Green Brand that the common pages (i.e. search results or my profile page), that are shared do not know what skin to use? If we apply no skin to language one is picked for us. Do other apply cookies in this scenario to apply the appropriate brand to the common page? If so how does that work and do you have access to the core components to apply cookie code?

 

Scenario 2 - Brand(s) -> Language(s)

The alternative scenario is to put Purple brand -> Language with 5 the languages live under that brand, and setup a Green Brand with all the languages under it. This uses out of the box functionality, but reporting is not as holistic. Yes, we could run two reports, and the common page problem is resolved in the first scenario.

 

Ideally, we would want scenario 1 Language -> Brand, but do not see a work around since we do not have access to allow cookie code to the common pages. I'm hoping to get what others have done to apply specific branding across all pages in a localized language.

 

Appreciate the feedback.

Thanks,

Tim

 

Below is a mock up of a structure in each scenario.

  • tmarshall - Add this code to the header and this should change the skin according the last page which user was on, i.e. if the user searched from green brand, the search page will have green skin and vice versa. Keep on adding the page names in line 2 and you can proceed with Scenario 1.

     

    <!-- The variable sticky_on_pages is contains all the pages where the "sticky skin" logic must apply -->
    
    <#assign sticky_on_pages = [ "MyProfilePage", "SearchPage" ] />
    
    <!-- If the current page has a name (should always be the case) and it is in the sticky_on_pages list, then apply the sticky skin logic. --> 
    <#if (page.name)?has_content && sticky_on_pages?seq_contains(page.name)>
    
      <#if http.session.getAttribute("skin")??>
        <#assign skin_id = http.session.getAttribute("skin") />    
        <#if utils.logs.name.common_init.debugEnabled>
          ${utils.logs.name.common_init.debug("setting skin to ${skin_id}")}
        </#if>    
        ${skin.set(skin_id)}
      </#if>  
    <#else>
       <#if coreNode.settings.name.get("skin.id")??>
        <#assign skin = coreNode.settings.name.get("skin.id")/>
        
        <#if utils.logs.name.common_init.debugEnabled>
          ${utils.logs.name.common_init.debug("storing skin ${skin}")}
        </#if>
              
        ${http.session.setAttribute("skin", skin)}
      </#if>  
    </#if>

     

    I hope this helps.

  • tmarshall - Add this code to the header and this should change the skin according the last page which user was on, i.e. if the user searched from green brand, the search page will have green skin and vice versa. Keep on adding the page names in line 2 and you can proceed with Scenario 1.

     

    <!-- The variable sticky_on_pages is contains all the pages where the "sticky skin" logic must apply -->
    
    <#assign sticky_on_pages = [ "MyProfilePage", "SearchPage" ] />
    
    <!-- If the current page has a name (should always be the case) and it is in the sticky_on_pages list, then apply the sticky skin logic. --> 
    <#if (page.name)?has_content && sticky_on_pages?seq_contains(page.name)>
    
      <#if http.session.getAttribute("skin")??>
        <#assign skin_id = http.session.getAttribute("skin") />    
        <#if utils.logs.name.common_init.debugEnabled>
          ${utils.logs.name.common_init.debug("setting skin to ${skin_id}")}
        </#if>    
        ${skin.set(skin_id)}
      </#if>  
    <#else>
       <#if coreNode.settings.name.get("skin.id")??>
        <#assign skin = coreNode.settings.name.get("skin.id")/>
        
        <#if utils.logs.name.common_init.debugEnabled>
          ${utils.logs.name.common_init.debug("storing skin ${skin}")}
        </#if>
              
        ${http.session.setAttribute("skin", skin)}
      </#if>  
    </#if>

     

    I hope this helps.

    • tmarshall's avatar
      tmarshall
      Advisor

      VarunGrazitti

       

      Thank you very much for your reply. I'll try it out. A colleague asked me to validate this approach with Lithium to confirm if it is an official API that is supported and will not be something that Lithium may deprecate or change without any notice. KristinaV can you please validate this one ;)

      • tmarshall's avatar
        tmarshall
        Advisor

        Hey VarunGrazitti

         

        I tried out the code today, and put copy/paste it in the "Page Head Top Content or "Page Header Bottom Content" in the wrapper on both the green skin and the purple skin. I then applied the appropriate skin to the category (i.e. the purple skin to Purple Brand category, and the green skin to the Green Brand category). I did not change the skin in the parent category "French" - I left the green skin applied to the language.

         

        Below is the code I used which is slightly updates with more pages, but when I click on profile when from purple categories it flips to the incorrect.

         

        <!-- The variable sticky_on_pages is contains all the pages where the "sticky skin" logic must apply -->
        
        <#assign sticky_on_pages = [ "MyProfilePage", "SearchPage", "ViewProfilePage", "FaqPage"] />
        
        <!-- If the current page has a name (should always be the case) and it is in the sticky_on_pages list, then apply the sticky skin logic. --> 
        <#if (page.name)?has_content && sticky_on_pages?seq_contains(page.name)>
        
          <#if http.session.getAttribute("skin")??>
            <#assign skin_id = http.session.getAttribute("skin") />    
            <#if utils.logs.name.common_init.debugEnabled>
              ${utils.logs.name.common_init.debug("setting skin to ${skin_id}")}
            </#if>    
            ${skin.set(skin_id)}
          </#if>  
        <#else>
           <#if coreNode.settings.name.get("skin.id")??>
            <#assign skin = coreNode.settings.name.get("skin.id")/>
            
            <#if utils.logs.name.common_init.debugEnabled>
              ${utils.logs.name.common_init.debug("storing skin ${skin}")}
            </#if>
                  
            ${http.session.setAttribute("skin", skin)}
          </#if>  
        </#if>

        As a test, I went to the "French" category and applied "none" as skin, then whatever 'default' skin is applied to "Top Level Community" will be applied. The sticky code does not appear to be working, but then again I might not be applying it correctly. Thanks again for your help, and appreciate if you can go into a bit more detail on if I missing something.

         

        Thanks,

        Tim