Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between `tt_content` and `pages`

Tags:

typo3

I am new in TYPO3 and I have one basic question, but I haven't found answer yet. What is the difference between pages and tt_content in TYPO3? And what is the best use case to use them?

Thanks

like image 867
Erich Schindl Avatar asked Mar 21 '17 14:03

Erich Schindl


3 Answers

Both are important tables in the database of a TYPO3 system.

  • pages - This table stores the pages that are created by editors in the backend. The field uid stores the unique ID of a page. The field pid (parent ID) relates to the parent page of the page. Most of the other fields are editable in the page properties through the backend.
  • tt_content - This table stores the content. It is arguably the most important table in a TYPO3 database. Like in the pages table the field uid stores the unique ID of a content element while the field pid (parent ID) relates to the page where the content element is placed on. Most of the other fields can be edited from the backend in the several types of content elements that TYPO3 provides. Note: not every content element uses every field in this table.

The best use case is to leave the tables alone and don't mess with their structure or integrity. They can be expanded with new fields if needed but should always be treated with care.

It is also a good idea to backup these tables (and the rest of the database) from time to time.

like image 195
Daniel Avatar answered Nov 15 '22 20:11

Daniel


You use pages to create a page tree.

Defininion of a page tree from TYPO3 documentation:

The page tree represents the hierarchical structure of your pages. In most >cases this corresponds exactly to the navigation structure of your web >site. The page tree can be expanded by clicking the little arrows on the >left of the items.

Content elements are just different types of content ... elements. There are different types of content elements in TYPO3: - text - which allows to insert just text - textpic - mix of text and image, with different combinations of layouts between text and image - files - allows to upload files to your page - html - type of content element which allows you to insert plain HTML code snippet

In TYPO3 CMS a content redactor adds content to a page, by using various content elements.

For more informations check out TYPO3 documentation website.


Database context

"pages" and "tt_content" these are also names of tables in TYPO3 CMS database. "pages" stores information about single page and "tt_content" stores informations about single content element.


TypoScript context

In TypoScript "tt_content" is an object which represents default rendering of CONTENT object. Paricular content elements such as "text" or "textpic" inherit some default settings from "tt_content". So it's a parent object to all content elements.

For more informations read about TypoScript and css_styles_content

like image 31
explorer Avatar answered Nov 15 '22 19:11

explorer


"The 'pages' table has a very special status. It is the backbone of TYPO3 CMS, as it provides the hierarchical page structure into which all other TYPO3 CMS managed records are positioned.

Standard pages are quite litterally web site pages in the frontend. But they can also be storage spaces in the backend, very much like folders on a hard disk. For any record, the "pid" field contains a reference to the page where that record is stored. For pages, the 'pid' fields behaves as a reference to their parent pages."

https://docs.typo3.org/typo3cms/InsideTypo3Reference/CoreArchitecture/Database/DatabaseStructure/Index.html#the-pages-table

In the table tt_content you find the Content elements linked to the pages table with the "pid" entry.

like image 33
Robert Avatar answered Nov 15 '22 21:11

Robert