title: TYPO3 6.2 output categories of a content element
body: <p>I use TypoScript to render content elements like that:</p>
  
  <pre><code>page.10 &lt; styles.content.get
  page.10.select.where = colPos=0
  page.10.wrap = &lt;section id="resources"&gt;&lt;h1 class="section"&gt;Resources&lt;/h1&gt;&lt;div class="accordion"&gt; | &lt;/div&gt;&lt;/section&gt;
  page.10.renderObj.stdWrap.dataWrap = &lt;div class="contentelement layout-{field:layout} type-{field:CType}"&gt; | &lt;/div&gt;
  </code></pre>
  
  <p>How can I output the categories associated with each content element? Ideally I would like to do it in the datawrap like {field:categories} but if that doesn't work I also wouldn't mind to append them in some separate HTML element.</p>
  
  <p>I tried to implement a JOIN with the sys_category_record_mm table but didn't get anything working.</p>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>Here is my latest try:</p>
  
  <pre><code>page.10.renderObj.stdWrap.postCObject = CONTENT
  page.10.renderObj.stdWrap.postCObject {
      wrap = &lt;p class="categories"&gt;|&lt;/p&gt;
      if.isTrue.field = categories
      table = tt_content
      select {
          uidInList.field = uid
          join = sys_category_record_mm ON tt_content.uid = sys_category_record_mm.uid_foreign JOIN sys_category ON sys_category.uid = sys_category_record_mm.uid_local
          orderBy = sys_category.sorting
      }
      renderObj = TEXT
      renderObj {
          field = title
          wrap = |&amp;nbsp;
      }
  }
  </code></pre>
  
  <p>This only outputs an empty <code>&lt;p class="categories"&gt;&lt;/p&gt;</code> if the content element has categories assigned. But the categories don't get listed.</p>