user2179985
user2179985

Reputation: 75

Typo3 6.0 - Content Object (Cobj) - Is it possible to display data from custom table?

I have a custom table "tx_myExt_domain_model_pub", and I want to display some records it contains.

For example, normally this is what I would do to display data from tt_content:

lib.footer = COA
lib.footer {
     10 = CONTENT
     10 {
         table = tt_content
         select.where = colPos = 10
         select.orderBy = sorting
         select.pidInList = 15
        }

  }

This is working perfectly, but I want to do the same thing with data from my custom table.

This is my actual TS and it's not working in my case:

lib.categories = COA
lib.categories{

   10 = TEXT
   10.wrap = <br/>

   20 = TEXT
   20.value = Publications
   20.wrap = <h2>|</h2>

   30 = CONTENT
   30 {
    table=tx_myExt_domain_model_pub
    select {
       pidInList = 32
       selectFields = uid,pid,publication
      }
    renderObj=COA
    renderObj{
            10=TEXT
            10.field=publication
            10.wrap=|<br/>
            20=TEXT
            20.field=uid
            20.wrap=|<br/>
      }
    }
  }

What did I do wrong ?

Upvotes: 0

Views: 859

Answers (1)

Urs
Urs

Reputation: 5132

There's nothing wrong with your code. I tested the following code with the categories of ext:news, which seem to be comparable to your table:

lib.categories = COA
lib.categories{

   10 = TEXT
   10.wrap = <br/>

   20 = TEXT
   20.value = Publications
   20.wrap = <h2>|</h2>

   30 = CONTENT
   30 {
    table=tx_news_domain_model_category
    select {
       pidInList = 159
       selectFields = uid,pid,title
      }
    renderObj=COA
    renderObj{
            10=TEXT
            10.field=title
            10.wrap=|<br/>
            20=TEXT
            20.field=uid
            20.wrap=|<br/>
      }
    }
  }

page.10 < lib.categories

It worked fine! Maybe there's something else wrong, either in your table or in your page ts.

Upvotes: 2

Related Questions