Forum Discussion

neel_psl's avatar
8 years ago

Customizing the 'SearchPage' skin

Hi,

 

We want to apply the different skins based on the category and the board context to the SearchPage, so can we do this?? Applying different skins to SearchPage or could we do it through API's???

 

 

Thanks

7 Replies

  • ClaudiusH's avatar
    ClaudiusH
    Khoros Alumni (Retired)
    8 years ago

    The SearchPage is not tied to a structure. Just like the Settings or Profile pages it sits outside the community structure you have. The closest you can get is customize the search experience based on which location the user has selected. The URL contains two relevant parameters:

    filter=location

    and

    location=forum-board:studio

    You can create a custom component that uses the http.request context object to obtain these. Then match them against a list of nodes (categories, TKBs and boards) and either add a CSS class container or inject some styling accordingly.

  • Additional to ClaudiusH 's approach you could try to set a different skin (if you really want or have an entire skin for that =D) within the page init script:

     

    this is completely untested!

     

    <#switch http.request.parameters.name.get("location")>
        <#case "location-1">
            <#assign skin = skin.set("<your.skin.name.for.that.location>") />
            <#break />
        <#case "location-2">
            ...
        <#default>
            ...
    </#switch>

    if you try it out, let me know if that works =)!

  • lukClaudiusH,

    I would like to know if there is any way to get currently assigned skin id for a particular node?

    As I would get the location id from search parameters, I want to check which skin is applied to that board before setting it to SearchPage inside page initialization or custom component.

    I did not find any APIs to get skin mapped to a particular node. 

    Any pointers?

     

    Thanks,

    Vaishnavi

  • vaishnavi's avatar
    vaishnavi
    Expert
    8 years ago

    Hi TariqHussain,

    I want to know skin id set for a particular node, not for the current rendering node.

     

    use case :-

    1. community - skin id "base"

    2. category1 (unique id is 200)- skin id "orange" (explicitly set from "Admin > Display> Skins" for this node)

    3. category2 (unique id is 201)- skin id "blue" (explicitly set from "Admin > Display> Skins" for this node)

    4.user searches some keyword(say 'test') from "location" filter for "category2"

    SearchPage parameters will be

    ?filter=location&q=test&location=category:201&collapse_discussion=true

     

    Requirement :-

    Now I want to get skin id which is assigned to the searched location node (category:201) and want to set that specific skin id to SearchPage instance.

     

    Thanks,

    Vaishnavi

  • luk's avatar
    luk
    Boss
    8 years ago

    vaishnavi you can query the skin setting via API v1, I never did with the numeric id though... try this: (replace the placeholders of course):

     

    // you need to be logged in as ADMIN! later on use restadmin() in FreeMarker
    https://<community.url>/restapi/v1/categories/id/<category.id>/settings/name/skin.id?restapi.response_format=json
    
    // in the page init script it would look something like this (untested):
    <#assign skin = restadmin("/categories/id/" + <category.id> + "/settings/name/skin.id") />

    Just checked in a few communities, I cannot find one that does this "numeric id" thing that you describe above?? What I see when setting a location filter is something like this: &location=category:<category.id.non-numeric>