[Typo3-dev] DB design and BE forms - a few questions

S. Teuber traveler_in_time at gmx.net
Tue May 31 19:08:56 CEST 2005


Hello,

there are a few questions puzzling me for a while now, and although I 
worked my way through various scripts and documentation files, some 
things still need clearance. That's why I open this thread, any help is 
appreciated.

The scenario:

TYPO3 uses to map its backend forms more or less directly to one 
corresponding database table; i.e. page configuration forms insert their 
data into "pages", content elements into "tt_content" etc.

Now, for a number of reasons it can be necessary to distribute data into 
more than one db-table, but still use just one BE-form to edit them (for 
the editors convenience). 

For example, consider setting up a product database which is not only 
used to generate html pages, but pdf documents and other output, too. In 
that case, there is product-related data that is relevant for all kinds 
of output, like "productname", "article-id" etc. Plus, there is a number 
of data that's used by just one kind of output, let's say 
"html_page_introtext" or "pdf_fancy_image". I consider it to be "clean" 
database design if those "additional information" is stored in seperate 
tables, like "html_specific_data" and "pdf_specific_data".

Or, imagine a plugin that has a rather large number of options, that is 
fields/columns. Adding, say, 20+ columns to tt_content, these columns are 
added not only for the content elements that really need them, but for 
*all* elements - wouldn't it be nice if they were transferred to a 
seperate table? ;-)

What I had in mind is splitting up the data over different tables and use 
a "tabbed" BE-form to edit them, the tabs being "general data", "html 
specific", "pdf specific", etc. The "dividers2tabs"-option in the TCA 
control section is perfect for that. BUT!

There are two problems in generating and handling the form.

1. How do you build a BE-form that uses fields from more than one 
database table?

2. How do you parse the data from that form back into the various tables?

On the second question, I had two approaches: using SQL-Views or 
modifying TCE, propably using an existing hook. None of them really did 
the trick so far. 

Using a view, there's the trouble of issuing DELETE-statements, as well 
as getting the sets of data "connected" (uid/pid). Plus, to my knowledge, 
noone ever used a CREATE VIEW-statement in an extension so far, exploring 
which side-effects that my have (or if it's even possible to create a 
view using ext_tables.sql). 

Modyfing TCE, I had some rough looks on the scripts, but the complexity 
(199 methods in TCEmain and TCEforms) prevented me from diving in further 
until issue 1 is solved.

Speaking of which... I know that alt_doc.php draws the BE-form. Although 
it can display more than one element, it can't do this in one form (with 
tabs) like mentioned above, can it? The inline documentation concerning 
var $editconf; seems to imply that records from more than one table can 
be edited on the same page, but that leaves the question of setting the 
according GPvars. If possible, I'd like to edit the records using the 
Web->List module, not through a new BE module, although, if this is the 
only solution, I'd do that, too. 

Phew. A complex matter. That's why I'm asking directly on the dev-list. 
If anybody can shed some light on this, it must be someone with deep 
knowledge of TYPO3 and TCE. Now, who's able to help?

Thanks for your attention, and may TYPO3 be with us,

Sven




More information about the TYPO3-dev mailing list