Forum Discussion

janjanssen's avatar
11 years ago

Contest Page get active tab

Hi,

 

In a contest page we want to load a custom component in the header, but only on an entries tab.

We can't use the page layout of entries tab, because the component needs to load above and outside the html of the tabs.

 

Is there a way to know which tab (home, winner, entries) is active? Could this be done via a REST API call or a context object?

 

Any thoughts?

 

Kr,

Jan Janssen

3 Replies

  • janjanssen We haven't used Li contests, but looking at the ideas in Li, which also have tabs, I can conclude following:

     

    When you click on tabs, the URL changes, you can use the following code to check if the URL contains entries or whatever the URL becomes after you go to the entries tab in contest and then dispay the header you want to.

     

    <#if http.request.url?contains("/t5/xyz/entries")>  //this will check if your URL contains entries or not.
    //code to display custom header
    </#if>

     

     

  • janjanssen's avatar
    janjanssen
    Guide
    11 years ago

    Hi grazitti,

     

    Thanks for your reply.  

     

    It's something we tried, but we have sometimes the entries as default tab.  In that case you don't have entries in the url :( .

     

    Mentioning this and after having a good sleep :),  I was thinking maybe create a combination of the url check, together with the check of the "default tab" admin setting.

     

    kr,

    Jan