KaelaC
13 years agoLithium Alumni (Retired)
Develop Board Latest Topics - Code Sample
Continuing on our code samples from the Dev Nation page, we have the latest topics from this very board. Since the Dev Nation page is a custom page (not part of a board or category) it exists at the top of our node structure. If we were to add the OOB Latest Topics module, we woudl all the latest topics across the whole community. Since we only wanted the latest from one particular board, we had to write it custom. Once again, we hard coded the board id ("studio") in. If you want to use this in your community, make sure you change that to your own id.
<#assign recent = restadmin("/boards/id/studio/topics/recent?page=1&page_size=3").messages /> <div class="devnet-latest-wrapper"> <div class="headline-devnet">From the Developer Forum </div> <div class="devnet-latest-content"> <div class="lia-component-forums-widget-message-list lia-component-message-list"> <table class="lia-list-wide"> <thead><tr><th scope="col" class="threadSubjectColumn lia-data-cell-primary lia-data-cell-text"> Subject </th><th scope="col" class="messageAuthorColumn lia-data-cell-secondary lia-data-cell-text"> Author </th><th scope="col" class="kudosCountColumn lia-data-cell-secondary lia-data-cell-integer"> Posted </th></tr></thead> <tbody> <#list recent.message as message> <#if message.deleted=="false"> <tr> <td class="threadSubjectColumn lia-data-cell-primary lia-data-cell-text"> <a href="${message.@view_href}">${message.subject}</a> </td> <td class="messageAuthorColumn lia-data-cell-secondary lia-data-cell-text"><@component id="common.widget.user-name" user="conv:${message.author.login}" /></td> <#if message.post_time.@view_friendly_date?? && message.post_time.@view_friendly_date?has_content> <#assign messageDate = message.post_time.@view_friendly_date /> <#else> <#assign messageDate = message.post_time.@view_date + " " + message.post_time.@view_time /> </#if> <td class="latestPostDateColumn lia-data-cell-secondary lia-data-cell-date">${messageDate}</td> </tr> </#if> </#list> </table> </div> <div class="lia-view-all" style="float:right"> <a href="/t5/Lithium-Developers/bd-p/studio">View All</a> </div> </div> </div>