Forum Discussion

JasonMi's avatar
JasonMi
Lithium Alumni (Retired)
10 years ago

Content into custom components

One of my clients is having trouble getting the content into his custom components. Can you someone please help out with where he is going wrong?
 
He used this code:
<#assign messages = rest("/topics/style/board/recent?page_size=3").messages />
<div class="custom-recent-articles-container">
  <#if messages.message?size gt 0>
    <div class="custom-recent-articles-heading-bar">
      <span class="custom-recent-articles-heading-bar-title">${text.format("")}</span>
    </div>
  </#if>
  <#list messages.message as message>
    <#assign posted_by_userid = message.author.login?string />
    <#assign posted_by_label = text.format("Posted By:") />
    <div class="custom-recent-article-wrapper">
      <div class="custom-article-header">
        <div class="custom-article-subject">
     <a href="${message.@view_href}">${message.subject}</a>
   </div>
        <div class="custom-article-posted-by">
          <span class="author">${posted_by_label} <#if ((posted_by_userid != "") && (posted_by_userid != "Anonymous"))><@component id="common.widget.user-name" user="conv:${message.author.login}" /></#if></span>
        </div>
      </div>
      <div class="custom-article-teaser">
        <#if message.teaser?length gt 0>
          ${message.teaser}
          <span class="custom-read-more"><a href="${message.@view_href}">${text.format("custom.component.latest_three_blog_articles.read_more")}</a></span>
        </#if>
      </div>
    </div>
  </#list>
</div>
 
I'm trying to retrieve this following content below by add in the "id" but I'm still getting error. I'm doing something wrong but I can't seem to figure it out. 
 
"type" : "board",
      "id" : "configuration",
      "href" : "/boards/configuration",
      "view_href" : "/t5/Pure-Customer-Product-Discussion/bd-p/configuration",
      "conversation_style" : "forum",
      "title" : "Pure Customer Product Discussion",
      "short_title" : "Pure Customer Product Discussion",
      "description" : "",
      "parent_category" : {
        "type" : "category",
        "id" : "forums",
        "href" : "/categories/forums",
        "view_href" : "/t5/Forums/ct-p/forums"
      },
      "root_category" : {
        "type" : "category",
        "id" : "forums",
        "href" : "/categories/forums",
        "view_href" : "/t5/Forums/ct-p/forums"
 
"id" : "pure-storage-knowledge",
      "href" : "/boards/pure-storage-knowledge",
      "view_href" : "/t5/Pure-Customer-Knowledge-Base/tkb-p/pure-storage-knowledge",
      "conversation_style" : "tkb",
      "title" : "Pure Customer Knowledge Base",
      "short_title" : "Pure Storage KB",
      "description" : "User Guides, Knowledge Base Articles, Best Practice Documents, Hardware Installation Guides, White Papers",
      "parent_category" : {
        "type" : "category",
        "id" : "kb",
        "href" : "/categories/kb",
        "view_href" : "/t5/Knowledge-Support/ct-p/kb"
      },
 
"type" : "board",
      "id" : "supportinternal",
      "href" : "/boards/supportinternal",
      "view_href" : "/t5/TSE-Discussion/bd-p/supportinternal",
      "conversation_style" : "forum",
      "title" : "TSE Discussion",
      "short_title" : "TSE Discussion",
      "description" : "General discussion for the support team internally.  Technical discussions, process requests, etc.",
      "parent_category" : {
        "type" : "category",
        "id" : "forums",
        "href" : "/categories/forums",
        "view_href" : "/t5/Forums/ct-p/forums"
      },
  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    JasonMi what error are you getting? And where are you getting it?

     

    If I just copy the code, paste it into a custom component and save it, there are no errors, and it returns data (in preview mode).

     

    2015-03-24_1027.png

    • JasonMi's avatar
      JasonMi
      Lithium Alumni (Retired)
      Looks like this was solved ... Thanks for the input!