简体   繁体   English

Typo3 6.0 - 内容对象(Cobj) - 是否可以显示自定义表格中的数据?

[英]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. 我有一个自定义表“tx_myExt_domain_model_pub”,我想显示它包含的一些记录。

For example, normally this is what I would do to display data from tt_content: 例如,通常我会这样做来显示来自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: 这是我的实际TS,它在我的情况下不起作用:

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 ? 我做错了什么 ?

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: 我使用ext:news的类别测试了以下代码,它们似乎与您的表格相当:

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. 也许在你的桌子或你的页面ts中还有其他错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM