Forum Discussion
After seeing your code looks like you are not very much familiar with the Lithium coding.
Use below code to fetch all the data for messages from community blogs:
<#assign messagesData = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE conversation.style='blog' AND depth = 0 ORDER BY post_time DESC LIMIT 3"?url).data.items /> <#list messagesData as msgs > ${msgs.subject} </br> </#list>
Above example I have added to show the subject only. Same you can use to show the other information from API. like author, url,avatar etc. And for images in message you need to add another API in the list by passing the id for message to it.
"SELECT * FROM images WHERE messages.id = 'msgs.id'"
and use it again in the list to fetch all the images from message.
Thank you, Parshant ,
You are right, I am not very much familiar with the Lithium coding. It is actually not easy to learn some practically useful things from the documentation sections in the Lithosphere. I mean I miss code examples not the glossaries and tables with the key/values and their definitions.
I am a little bit confused by the things like:
${msgs.subject}
As I can see there is no such key "msgs" in the API 2.0 Collections glossary. But there is key "messages". Is the glossary out of date or I missed something?
Could you please suggest me some practical tutorials/video lessons explaining how to use LiQL together with the FreeMarker to customize common community components like for example Latest Blog posts?
Thank you!
- Parshant7 years agoBoss
If you check my code.
<#list messagesData as msgs > ${msgs.subject} </br> </#list>
I have added a <#list> which is basically we use for loop the data to listing a sequence (or collection) of items, and to list the key-value pairs of a hash.
in above code you can see I have added
<#list messagesData as msgs >
which list out all the collection in between "messagesData" and then make them to a varibale defined as "msgs" .
Related Content
- 3 months ago
- 4 months ago
- 30 days ago
- 3 years ago