The “ctrl” part of the $TCA configuration of a table determines how Typo3 handles the table generally.
$TCA["user_photomarathon"] = Array ( "ctrl" => Array ( "label" => "title", "tstamp" => "tstamp", "crdate" => "crdate", "fe_cruser_id" => "fe_cruser_id", "delete" => "deleted", "title" => "Photo Marathon image|Photo Maraton Billede|Photo Marathon Bild", "iconfile" => "../fileadmin/photomarathon/user_pm_icon.gif", "enablecolumns" => Array ( "disabled" => "hidden", ) ),
This is a list of comments on the “ctrl” section of the user_marathon table as shown above:
“label” contains a stringvalue, namely the fieldname from which the record title shown in record listings in the backend should be fetched. Required for all tables.
“tstamp” contains a stringvalue, namely the fieldname which will be updated with the current time value on each update through TCE (See Typo3 Overview drawing).The “tstamp” field is configured for almost all tables, the field should be an integer and basically this field will contain the “last modified” value.
“crdate” contains a stringvalue, namely the fieldname which will be set to the date when the record was first created. This value should never change thereafter. The “crdate” field should be an integer.
“fe_cruser_id” contains a stringvalue, namely the fieldname which will hold the reference to the Website user (from fe_users) which created the record through the fe_adminLib! This is totally related to the frontend plugin fe_adminLib and so has no significance for the backend.
“delete” contains a stringvalue, namely the fieldname which - if set - will totally hide the record from (almost) any function in Typo3. This means in turn that deleted PhotoMarathon records are not really deleted but merely hidden so they can be recovered.
“title” is a stringvalue; the title of the table as shown in the backend. This string value is exploded by the | (vertical line) character and each part represents a specific language (as configured in t3lib/config_default.php). This value is required. If you do not specify any language specific values, the default (english) will be used.
“iconfile” points to the icon file (currently GIF) to use. If no path prefix is set, the icon will be searched for in the typo3/gfx/i/ folder. The icon must be a 18x16 pixels icon and will be manipulated with overlaid graphics by the backend if needed to.
“enablecolumns” is an array with four fixed associative keys. They has impact on the look of the icon in the backend but does not hide the records in the backend though. The fields rather determines visibility of the record in the frontend (where the API function enableFields should be used to retrieve a correct WHERE-clause for the selection of records from any Typo3 configured table).The full range of enablefields are used by such tables as “pages” and “tt_content”.
“disabled” points to the field, which as an integer set to 1 will signify that the record is hidden. Zero means the record is not hidden.
“starttime” points to the field, which will hold the “Start” time for the record display (always UNIX time integer).
“endtime”, like starttime, but of course signifies the date where the record will not be displayed anymore.
“fe_group” points to the field, which holds a reference to the fe_groups id which is exclusively allowed access to view the record. This field is normally called “Access”.
Notice: There are other options which are documented in “Inside Typo3”.
In the record list from before we see the impact of the “label” configuration pointing to the “title” field of user_photomarathon; The title is “The Queens Soldiers”. Furthermore the state of the enablecolumns/disable - the “hidden” field - is also shown by the record icon being dimmed and having a red cross on it:
The latter is quickly un-hidden by a click in the Control Panel:
... and immediately the record is not hidden anymore.
Looking at the previous SQL-dump of the table we see that blue lines (below) has been utilized for system purposes through configuration in the “ctrl” section in $TCA.
The remaining red lines are not. They are mandatory and should largely be configured exactly like you see here including the indices set in the bottom of the listing:
CREATE TABLE user_photomarathon (
uid int(11) unsigned DEFAULT '0' NOT NULL auto_increment,
pid int(11) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(3) unsigned DEFAULT '0' NOT NULL,
title tinytext NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
photodate int(11) DEFAULT '0' NOT NULL,
description text NOT NULL,
images tinyblob NOT NULL,
fe_cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (uid),
KEY parent (pid)
);
There are two simple rules:
“uid” is a unique, automatically incremented integer. It's the unique and authoritative reference to any editable record in Typo3. Sometimes it's called the “id” in loose terms.
“pid” is an integer. It is a relation pointing to the record (“Page”) from the backbone table “pages” to which it belongs. If you picture the page tree as folders and files in a filesystem, the “pid” value basically indicates in which folder (here: page) the file (here: user_photomarathon record) is found.
The principle is shown here:
The user_photomarathon record has become the uid “1” and it is found on the page with uid “139” (sometimes page id's are refered to as the “pid” in the context of the a record belonging to a page).
In the phpMyAdmin view it looks like:
This should suffice to demonstrate this simple but vital concept. The power of this principle lies in the fact that records are thus naturally categorized by the page they belong to. How you choose to take advantage of this is up to you to a certain extend.
While a pid value of 0 (zero) or less can never point to a record, exactly the zero value is valid. If the pid value of a record is zero it means the record belongs to the root of the page tree. However records are divided sharply into two categories; records which are allowed in the root (and in turn editable by the admin-users only!) and recods which must belong to a proper page record (the only exception is “pages” records which form the very page tree).