Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

TSref/select

From TYPO3Wiki
Jump to: navigation, search
TypoScript This page is document in progress.

other Typoscript functions

select

This object generates an SQL-select statement needed to select records from the database.

Is used by the CONTENT Object.

Some records are hidden or timed by start and end-times. This is automatically added to the SQL-select by looking in the tables.php-array (enablefields)

Also, if the "pidInList" feature is used, any page in the pid-list that is not visible for the user of the website IS REMOVED from the pidlist. Thereby no records from hidden, timed or access-protected pages are selected! Nor records from recyclers.

Property: Data type: Description: Default:
uidInList list of page_id
pidInList list of page_id /stdWrap this
recursive Until TYPO3 4.5: int

Since TYPO3 4.6: int /stdWrap

Recursive levels for the pidInList 0
orderBy SQL-orderBy

Since TYPO3 4.5: SQL-orderBy /stdWrap

without "order by"! Eg. "sorting, title"
groupBy SQL-groupBy

Since TYPO3 4.5: SQL-groupBy /stdWrap

without "group by"! Eg. "CType"
max int

+calc +"total"

max records

Special keyword: "total" is substituted with count(*)

begin int

+calc

+"total"

begin with record number value

Special keyword: "total" is substituted with count(*)

where SQL-where without "where"!, Eg. " (title LIKE '%SOMETHING%' AND NOT doktype) "
andWhere SQL-where /stdWrap without "AND"!, Eg. "NOT doktype".
languageField string If set, this points to the field in the record which holds a reference to a record in sys_language table. And if set, the records returned by the select-function will be selected only if the value of this field matches the $GLOBALS[“TSFE”]->sys_language_uid (which is set by the config.sys_language_uid option)
selectFields string List of fields to select, or “count(*)”. *
join

leftjoin

rightjoin

string Enter tablename for JOIN , LEFT OUTER JOIN and RIGHT OUTER JOIN respectively.
markers array of markers The markers defined in this section can be used, wrapped in the usual ###markername### way, in any other property of select. Each value is properly escaped and quoted to prevent SQL injection problems. This provides a way to safely use external data (e.g. database fields, GET/POST parameters) in a query.

.value (value) sets the value directly

.commaSeparatedList (bool) If set the value is interpreted as a comma separated list of values. Each value in the list is individually escaped and quoted.

(stdWrap properties ...) All stdWrap properties can be used here

[tsref:->select]

Example

page.60 = CONTENT
page.60 {
   table = tt_content
   select {
       pidInList = 73
       where = header != ###whatever###
       orderBy = ###sortfield###
       markers {
         whatever.data = GP:first
         sortfield.value = sor
         sortfield.wrap = |ting
       }
   }
}
Go to: typo3.org    
Login, and you can edit.
Personal tools
Namespaces

Variants
Actions