In according to designs I need to show all topics with pagination on the Community Page. I was trying to use XML description from Recent Posts Page
<add to="main-content"> <component id="replies-filter" wrapper="lia-menu-bar"/> <component id="pager" wrapper="lia-menu-bar"/> <component id="messages.widget.recent-posts"/> <component id="pager"/> </add>
I have added this to the Community Page and now I have some issues:
Recent posts are shown, but as posts, not as topics. Is it possible to configure component to show topics?
Pager is not working. It is just not showing up. Am I missing something? Or is it impossible to use pager on Community Page?
Thanks in advance!
Solved! Go to Solution.
@oleh-kastornov - These components don't have scope to the Community Page. If you want to get the Latest topics on Community Page, then you need to create a custom component using API calls.
Below is the API call, you can use to fetch the latest topics from a particular interaction style(forum, TKB, Idea or Blog😞
<#assign getDiscussions = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE conversation.style='forum' and depth=0 ORDER by post_time DESC"?url).data.items />
<#list getDiscussions as discussion>
For Pagination, you can use Freemarker Pagination by following the below code:
<#assign getDiscussionsCount = rest("2.0","/search?q=" + "SELECT count(*) FROM messages WHERE conversation.style='forum' and depth=0"?url).data.count /> <!-- nombre d'item par page --> <#assign itemPerPage = 6/> <!-- page courante (par default 1 ) --> <#if webuisupport.path.parameters.name.get("page")??> <#assign page_number = webuisupport.path.parameters.name.get("page") /> <#else> <#assign page_number = 1 /> </#if> <!-- Instanciation pagination --> <#assign pageable_item = webuisupport.paging.pageableItem .setCurrentPageNumber(page_number) .setItemsPerPage(itemPerPage) .setTotalItems(getDiscussionsCount?number) .setPagingMode("enumerated") .build />
Please let me know if this helps.
Hi @Payal ! Thanks for this info. One of options I had was the option to create custom component. Just wanted to be sure that this is not implementable via out of the box components. Thank you.
Welcome to the Technology board!Curious about our platform? Looking to connect on social technology? You've come to the right place!