Forum Discussion

domladden's avatar
9 years ago

Page Initialization Script

Hi does anyone know if the PI script takes a while to take effect?

 

I had a generic quilt replacement script in place:

 

<#if clientDevice.mobile>
${http.response.replaceQuilt("MobileCategoryPage","CustomQuilt") }

${http.response.replaceQuilt("MobileBlogPage","CustomQuilt") }
${http.response.replaceQuilt("MobileBlogArticlePage","CustomQuilt") }
</#if>

 

And this worked fine. However, I wanted to apply this to specific categories and not every category in my community, I implemented a check and changed the whole script, including removing the MobileBlogArticlePage replacement entirely.

 

I thought it had worked correctly but all the categories were still changing quilts, including the article pages.

 

I removed the whole PI script and checked everything was working as before, then when it was I put in the following script:

 

<#if clientDevice.mobile>
<#if webuisupport.path.parameters.name.get("ct-p","") = "example" >
${http.response.replaceQuilt("MobileCategoryPage","CustomQuilt") }
</#if>
<#if webuisupport.path.parameters.name.get("bg-p","") = "example">
${http.response.replaceQuilt("MobileBlogPage","CustomQuilt") }
</#if>
</#if>

 

But nothing is happening, does anyone know why the script didn't seem to stop working even when it had been removed and/or whether the script above should work?

 

Thanks,

 

Dom

 

 

 

 

 

  • ChiaraS's avatar
    ChiaraS
    9 years ago

    try 

     

    <#if coreNode.id == "en">

    since that's case sensitive...

  • ChiaraS's avatar
    ChiaraS
    Lithium Alumni (Retired)

    the code is probably throwing an exception in the backend but not visible to you in Studio. 

    the problem is that the webuisupport object can't be used in the page initialization, I would try to use coreNode instead to check the nodeType and id.

     

     

     

    • domladden's avatar
      domladden
      Ace
      Hi Chiara, thanks for your reply.

      I changed the check to be <#if corenode.ID = "en" > as "en" is the ID of my category but still with no luck, I feel like I'm missing something super simple.

      What do you think?

      Thanks again,

      Dom
      • ChiaraS's avatar
        ChiaraS
        Lithium Alumni (Retired)

        try 

         

        <#if coreNode.id == "en">

        since that's case sensitive...