Forum Discussion

clemlith's avatar
clemlith
Expert
11 years ago
Solved

Knowing if a custom content is empty or not

Hi Everyone,

I love custom content because they allow me to push something live without having to go through studio and doing a studio push.

 

I wondering if there is a way to know if a custom content is filled with content or not ?

Ideally this test would be available at every node level.

 

If you have the answer please share it with me :)

 

Best,

Clement

 

 

  • Hi clemlith 

     

    I am assuming you are asking for a way to do this programmatically - as the Admin section will tell you if the element has content at that level of the community structure.

     

    If I am correct, then you may want to have a look at this TKB article that explains how you can retrieve the custom content (or test for the absence of it) using the REST API.

     

    I hope this helps!

4 Replies

  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)
    11 years ago

    Hi clemlith 

     

    I am assuming you are asking for a way to do this programmatically - as the Admin section will tell you if the element has content at that level of the community structure.

     

    If I am correct, then you may want to have a look at this TKB article that explains how you can retrieve the custom content (or test for the absence of it) using the REST API.

     

    I hope this helps!

  • clemlith's avatar
    clemlith
    Expert
    11 years ago

    Hi PaoloT ,

    Thanks, This was exactly what I was looking for !

    I would have been very nice if a freemarker directive(or somthing else) existed in order to get automatically the content of the custom content on the current node.

    iftomkinsDid you find the answer to the question you were raising in the comment of the TKB article mentioned by Paolo ?

     

    Best,

    Clement

  • iftomkins's avatar
    iftomkins
    Maven
    11 years ago

    clemlith I did eventually find a solution that works in most situations. There are still times when it's difficult to create conditionals based on where the user is (such as if an idea board and a forum board have the same exact id, which is possible). I was provided with a snippet and explanation in this thread, which will hopefully help.

     

     

     

     

  • clemlith's avatar
    clemlith
    Expert
    11 years ago

    iftomkinsThanks for the additional information. I think you're right it seems that there is always tricky case.

    I don't know if you noticed it but there is a json object called LITHIUM.CommunityJsonObject which contains various usefull informations such as the current node id. You may see it in details whan you display the source code of the lithosphere.

    But it would be usefull only if you need it on the client side.

     

    Best,

    Clement