This page is still a beta!

Tutorials


9.6. RECORD

This cObject is used to retrieve single records. CONTENT was designed to get a list of records - normally from the table tt_content. But it could be any table:

A quick example:

page.10 = RECORDS
page.10.source = 1
page.10.tables = tt_content
page.10.conf.tt_content = TEXT
page.10.conf.tt_content {
  field = header
  case = upper
  wrap = <B> | </B>
}

results in:

... because the record from table "tt_content" with uid "1" was :

Another example:

In the tt_address database there are a few records with Simpsons characters. They are at the page "Another site in.../Lists/Addresses/"

temp.tt_address = COA
temp.tt_address.wrap = | <HR>
temp.tt_address.10 = TEXT 
temp.tt_address.10 {
  field = name
  case = upper
  wrap = <B> | </B><BR>
}
temp.tt_address.20 = IMAGE
temp.tt_address.20 {
  file.import.field = image
  file.import = uploads/pics/
  file.import.listNum = 0
  file.height = 100
}
page.10 = RECORDS
page.10.source = 3,1,5
page.10.tables = tt_address
page.10.conf.tt_address < temp.tt_address

Results in:

Notice how "tt_content" in the first TypoScript is now "tt_address" because we're working on a different table.

An alternative implementation does exactly the same is this:

tt_address = COA
tt_address.wrap = | <HR>
tt_address.10 = TEXT 
tt_address.10 {
  field = name
  case = upper
  wrap = <B> | </B><BR>
}
tt_address.20 = IMAGE
tt_address.20 {
  file.import.field = image
  file.import = uploads/pics/
  file.import.listNum = 0
  file.height = 100
}
page.10 = RECORDS
page.10.source = 3,1,5
page.10.tables = tt_address

Notice how the line "page.10.conf.tt_address < temp.tt_address" was removed. That line copied the object "temp.tt_address" and used that for rendering of the record. But the default option is to use the toplevel object named like the table. Thus "tt_address" on the toplevel would render the record if this line is left out and that's exactly what the example shows ("temp.tt_address" was changed to "tt_address").