kgroneman
7 years agoBoss
Is a teaser from multiple TKBs possible?
I'm not a developer but I'd like to know if it's possible to create a teaser custom content box from multiple TKBs? We currently have the following code to provide a teaser for a single blog that I could probably change to pull from a single TKB but I need content from multiple TKBs:
<#-- Blog teaser v4--> <#-- change the "board.id" in the query to focus on a different blog/board --> <#include "message-macros"/> <#assign qry = "SELECT id, view_href, author.id, author.view_href, author.login, subject, teaser, body, post_time, post_time_friendly, conversation.style, board.id, board.title, board.view_href, current_revision.last_edit_time FROM messages WHERE conversation.style = 'blog' AND board.id='sws-571'ORDER BY post_time DESC LIMIT 5" /> <#assign messages = executeLiQLQuery(qry) /> <#if messages?size gt 0> <#assign brd = messages[0] /> <div class="lia-panel lia-panel-standard custom-component-blogteaser"> <div class = "lia-panel-content-wrapper"> <div class="lia-panel-content"> <#list messages as msg> <a href="${getFieldValue(msg.view_href)}" target="_top"> <ul> <li> <h3 style='display:inline'>- ${getFieldValue(msg.subject)} </h3></a> <p style='display:inline'> By: ${getFieldValue(msg.author.login)}</p> </li> </ul> </#list> </div> </div> </div> </#if>
Yes, it can be done for multiple TKBs/blogs/boards. You can use "IN" query to pass the multiple TKB boards in a single query. Like this
SELECT id FROM messages WHERE conversation.style = 'tkb' AND board.id IN ('sws-571','sws-999', 'sws-777')ORDER BY post_time DESC LIMIT 5