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 al...
  • VarunGrazitti's avatar
    9 years ago

    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.