DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Browser Tutorial Database (en)

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed:2011-03-14T21:50:58
Classification:browser_tut_database_en
Description:Tutorial Database for the Browser - the Frontend Engine
Keywords:forAdmins, forDevelopers, forBeginners, forAdvanced, browser, tutorial, frontend-engine, frontend, engine, database, sql, relations
Author:Dirk Wildt, Die Netzmacher
Email:wildt.at.die-netzmacher.de
Website:http://die-netzmacher.de
Language:en

img-1 img-2 extKey: browser_tut_database_en img-3

Browser Tutorial Database (en)

img-4

Version: 3.6.3, 2011-03-14

Extension Key: browser_tut_database_en - Tutorial for the extension Browser (extkey: browser)

Language: en

Keywords: forAdmins, forDevelopers, forBeginners, forAdvanced, browser, tutorial, frontend-engine, frontend, engine, database, sql, relations

Copyright 2009 - 2011, Dirk Wildt, Die Netzmacher, <wildt.at.die- netzmacher.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.org

Table of Contents

Browser Tutorial Database (en) 1

Introduction 3

What does the Tutorial do? 3

Further Information 3

This tutorial in PDF format 3

Browser Manual and Browser Tutorial Basics 3

What are Relations? 4

TYPO3 Relations 4

Simple Relation 5

MM Relation 6

Programming your own Relation? 6

Example SQL Query 7

Enjoy the Browser 7

What does the Browser do? 7

Configuration with the Plugin 8

Simple Relation - Example with FE Users and their Groups 8

TypoScript 8

Configuring the Plugin 8

Result in the Frontend 9

Simple Relation - Example with BE Users and their Groups 9

Records on the Root Level 9

TypoScript 9

Configuring the Plugin 9

Result in the Frontend 10

MM Relation - Example with News and their Categories 11

TypoScript 11

Configuring the Plugin 11

Result in the Frontend 11

Configuration with TypoScript 12

Customizing 12

Plugin 12

TypoScript 13

DRS - Development Reporting System 13

Simple Relation 14

Plugin 14

TypoScript 14

Simple Relation - Several Relations to one Foreign Table 15

Under Development 15

TypoScript 15

Simple Relation with configured Relation Field 16

Example: Mapping to fe_users.username 16

MM Relation 16

Plugin 17

TypoScript 17

One table, nine relations 18

SQL Functions 19

Step 1: Synonyms 19

TypoScript 20

Step 2: Hierarchical Order 21

TypoScript 22

The Generated SQL Query 23

orderBy 24

Local table (parent) 24

TypoScript snippet 24

Comment 24

Reference 24

Foreign table (children) 25

Screen shots 25

TypoScript snippet 26

Comment 26

Reference 26

Reference 27

What's new in Version 3.6? 28

Simple relations: Configurable foreign table field 28

Helpful suggestions 29

Forum 29

Credits 30

netresearch 30

To-Do List 31

Change Log 32

Illustration Index 33

img-5 Illustration 1: Tutorial in PDF format

Introduction What does the Tutorial do? ^^^^^^^^^^^^^^^^^^^^^^^^^^

This is a tutorial for the extension Browser (extkey: browser).

It is

a step-by-step introduction for the configuration of the database.

only.

Topics are

  • Relation Building
  • Using special functions, which are provided by the Browser.

If you are interested in other issues, please note the section "Further Informations" below.

What are Relations?

If you are using more than one table, you need a relation, which connects both tables with each other.

You are working with relations all the time.

For example:

  • If you selecting a group for a backend user.
  • If you selecting a category for a news.

See the illustrations below.

Frame4

Frame4

TYPO3 Relations

TYPO3 enables two relation methods:

  • The "Comma list" method: The local tables stores the relation to the records in a foreign table as a comma list. We call the comma list method the simple relation.
  • The "MM" method: Relations will be stored in an extra relation table.
Simple Relation

Frame4

The local table be_users (on the left hand) stores in the field "usergroup" the uids of the records in the table be_groups (right).

"usergroup " is empty, if there is no relation like in the record 1.

"usergroup" has comma separated values (csv), if there is more than one relation like in the record 7.

MM Relation

Frame4

The local table tt_news (on the left hand) needs the field "category" only for storing the case, if a record has a relation or not.

If it has a relation, category will be 1, if it hasn't, category will be 0.

The MM table tt_news_cat_mm stores any relation (middle). Any relation needs one record.

It connects a record in the local table with its uid to the record in the foreign table (right hand).

Frame4

The tt_news_record 5 has one relation in the illustration above. See the table tt_news_cat_mm in the middle of the illustration.

The tt_news record 11 has four relations.

Programming your own Relation?

If you are developing an extension with a frontend plugin, you have to program any relation by your own.

You have to care about

  • permissions like if a record is hidden,
  • if it is owned by a frontend user group,
  • if it has needs for a search and
  • if it has needs for localization.

If you like to program a professional extension, you will have a lot of work.

Example SQL Query

Maybe you guess it's easy.

We show you a SQL query, which should displays

  • a news with its category
  • in a language selected by the visitor
  • and with the sword "EUR"

SELECT tt_news.title AS 'tt_news.title', tt_news_cat.title AS 'tt_news_cat.title',

tt_news.uid AS 'tt_news.uid', tt_news_cat.uid AS 'tt_news_cat.uid',

tt_news.sys_language_uid AS `tt_news.sys_language_uid`,

tt_news.l18n_parent AS `tt_news.l18n_parent`,

tt_news_cat.title_lang_ol AS `tt_news_cat.title_lang_ol`

FROM tt_news LEFT JOIN tt_news_cat_mm

ON (tt_news.uid = tt_news_cat_mm.uid_local )

LEFT JOIN tt_news_cat

ON

(

tt_news_cat_mm.uid_foreign = tt_news_cat.uid

AND tt_news_cat.deleted=0 AND tt_news_cat.hidden=0

AND ( tt_news_cat.starttime<=1254660120 )

AND ( tt_news_cat.endtime=0 OR tt_news_cat.endtime>1254660120 )

AND (

tt_news_cat.fe_group='' OR tt_news_cat.fe_group IS NULL

OR tt_news_cat.fe_group='0'

OR (

tt_news_cat.fe_group LIKE '%,0,%' OR tt_news_cat.fe_group LIKE '0,%'

OR tt_news_cat.fe_group LIKE '%,0' OR tt_news_cat.fe_group='0'

)

OR (

tt_news_cat.fe_group LIKE '%,-1,%' OR tt_news_cat.fe_group LIKE '-1,%'

OR tt_news_cat.fe_group LIKE '%,-1' OR tt_news_cat.fe_group='-1'

)

)

AND tt_news_cat.pid IN (1081)

)

WHERE tt_news.deleted=0

AND tt_news.t3ver_state<=0

AND tt_news.hidden=0

AND ( tt_news.starttime<=1254660120 )

AND ( tt_news.endtime=0 OR tt_news.endtime>1254660120 )

AND ( tt_news.fe_group='' OR tt_news.fe_group IS NULL

OR tt_news.fe_group='0'

OR ( tt_news.fe_group LIKE '%, 0, %' OR tt_news.fe_group LIKE '0, %'

OR tt_news.fe_group LIKE '%, 0' OR tt_news.fe_group='0'

)

OR ( tt_news.fe_group LIKE '%, -1, %' OR tt_news.fe_group LIKE '-1, %'

OR tt_news.fe_group LIKE '%, -1' OR tt_news.fe_group='-1'

)

)

AND ( tt_news.sys_language_uid <= 0 OR tt_news.sys_language_uid = 1 )

AND ( tt_news.title LIKE '%EUR%' OR tt_news_cat.title LIKE '%EUR%' )

AND tt_news.pid IN (1081)

ORDER BY tt_news.title, tt_news_cat.title

Do you guess any longer, it's easy to build a professional relation?

Enjoy the Browser

What does the Browser do?

Let the Browser work for you: It generates the whole query.

Configuration with the Plugin

Frame4

The Browser processes both table relations by default.

Simple Relation - Example with FE Users and their Groups

You need the tables fe_users and fe_groups.

TypoScript

plugin.tx_browser_pi1 {

views.list.1.select = fe_users.username, fe_groups.title

}

Configuring the Plugin

Frame4

The Startingpoint must be connected with the sysfolder, which contains the frontend user - in our example it is the sysfolder fe_user.

That's all.

Result in the Frontend

Frame4

Simple Relation - Example with BE Users and their Groups

Records on the Root Level

To display backend users is a special case, because they aren't stored in any sysfolder. All be_users have the pid 0, the pid of the TYPO3 root.

The Browser enables the displaying of records on the root level.

TypoScript

plugin.tx_browser_pi1 {

views.list.1.select = be_users.username, be_groups.title

}

img-7 Illustration 10: Display records without any pid

Configuring the Plugin Please configure the tab [General].

Field [Configure Relations]: Please select "Configured"

Field [Records without Pid]: Please enable "Display records of the root level too".

Field [Startingpoint]: Leave it empty, you don't need it.

That's all.

Result in the Frontend

Frame4

MM Relation - Example with News and their Categories

You need the extension tt_news.

TypoScript

plugin.tx_browser_pi1 {

views.list.1.select = tt_news.title, tt_news_cat.title

}

Configuring the Plugin

Frame4

The Startingpoint must be connected with the sysfolder, which contains the news - in our example it is the sysfolder news.

That's all.

Result in the Frontend

Frame4

Configuration with TypoScript

Sometimes you don't have a proper TYPO3 relation. One reason for a non proper TYPO3 relation can be, that an extension is developed as a standalone application and is integrated in TYPO3 later. The extension civserv is an example.

In cases of failure there are two possibilities for a solution:

If you have a simple relation:Use the automatically relation building but adapt the configuration array

plugin.tx_browser_pi1.autoconfig.relations

If you have a complex relation, this is recommended:Build your own SQL query.

Customizing

Plugin

Frame4

Set the field [Table Relations] to "Only TypoScript"

TypoScript

The relation building has a TypoScript array.

plugin.tx_browser_pi1 {

autoconfig {

relations {

...

}

}

}

The elements of the array should be self-explanatory. See the illustration below.

Frame4

DRS - Development Reporting System

Switch on the DRS - Development Reporting System. Take one of these logging modes:

  • SQL development
  • All

You should get helpful messages, if you want to change the configuration for auto relation building like this:

[INFO/SQL] TCA 'tt_news.category.config.foreign_table: 'tt_news_cat'

[INFO/SQL] Result (MM): tt_news - tt_news_cat_mm - tt_news_cat

[HELP/SQL] Switch off the result above? Use TS config: autoconfig.csvDontUseFields = ...,tt_news.category, ...

See the illustration below.

Frame4

Simple Relation

This is an example with the frontend users.

You need the tables fe_users and fe_groups.

Plugin

Frame4

Set the field [Table Relations] to "Only TypoScript"

Startingpoint has to be the sysfolder, which contains the frontend users and their groups.

TypoScript

plugin.tx_browser_pi1 {

autoconfig {

relations = 0

}

views {

list {

1 {

select = fe_users.username, fe_groups.title

relations {

simple {

fe_users {

usergroup = fe_groups

}

}

}

}

}

}

}

Comment

Line 3: The Browser doesn't build any relation.

From line 9 to 15: Building the relation by your own. The syntax should be easy to understand:

  • relations.simple. your_table.your_field_for_relation = related_table
  • relations.simple. fe_users.usergroup = fe_group

Simple Relation - Several Relations to one Foreign Table

Since version 3.4.4 it is possible, to use several relations to one foreign table.

This feature is wonderful, if you like to relate from several fields in the local table to a table like fe_users.

Under Development

Take care: This feature is under development.

Restrictions:

  • I is only available for single views.
  • The value of the TypoScript array has to contain marker with the foreign table.
  • The TypoScript array type has to be TEXT.

There isn't any localisation support!

TypoScript

plugin.tx_browser_pi1 {

views {

single {

1 {

select (

tx_organiser_production.title,

tx_organiser_production.actor

)

tx_organiser_production {

actor = COA

actor {

10 = TEXT

10 {

browser {

handleRelation = 1

orderBy = fe_users.last_name

devider = TEXT

devider {

value = ,

noTrimWrap = || |

}

}

value = ###FE_USERS.FIRST_NAME### ###FE_USERS.LAST_NAME###

typolink {

parameter = {$myConst.pages.staff}

parameter {

insertData = 1

}

additionalParams = &tx_browser_pi1[staffUid]=###FE_USERS.UID###&###CHASH###

}

}

}

}

}

}

}

}

Comment

The TypoScript snippet from above displays a production :sup:`0 <#sdfootnote1sym>`_ (local table) with a list of fe_users (foreign table).

There are two specialties:

  • The select statement doesn't contain any foreign table. fe_users is missing. It isn't needed.
  • The TEXT array has an array browser.
In Details

Line 10 - 12: The TEXT array have to be a member of a COA array

Line 14 - 22: browser arrayhandleRelation: You have to enable the feature (because it has performance costs)orderBy: The statement will be part of the SQL query.devider: Array for deviding the children records. First record will ignore it. If devider isn't set,. the Browser will take the values from the array advanced.sql.devider.childrenRecords.devider has to be of the type TEXT.

Simple Relation with configured Relation Field

It is possible to configure which foreign table field will be used as relation endpoint.

Currently, 'uid' is always used:

relations {

simple {

tx_some_projektliste {

proj_dozent = fe_users

}

}

}

This maps tx_some_projektliste.proj_dozent to fe_users.uid and it is the same like

relations {

simple {

tx_some_projektliste {

proj_dozent = fe_users.uid

}

}

}

Example: Mapping to fe_users.username

If you like to map to username, you have to use this TypoScript snippet

relations {

simple {

tx_some_projektliste {

proj_dozent = fe_users.username

}

}

}

MM Relation

This is an example with the extension tt_news.

Plugin

Frame4

Set the field [Table Relations] to "Only TypoScript"

Startingpoint has to be the sysfolder, which contains the news and categories.

TypoScript

plugin.tx_browser_pi1 {

autoconfig {

relations = 0

}

views {

list {

1 {

select = tt_news.title, tt_news_cat.title

relations {

mm {

tt_news {

tt_news_cat_mm = tt_news_cat

}

}

}

}

}

}

}

Comment

Line 3: The Browser doesn't build any relation.

From line 9 to 15: Building the relation by your own. The syntax should be easy to understand:

  • relations.mm. your_table.your_table_for_relation = related_table
  • relations.mm. tt_news.tt_news_cat_mm =tt_news_cat

One table, nine relations

If you need an example for an table with a lot of relations here it is. In this case we have a database with ships. The most data are stored in one table, the main table: tx_ships_main. But all data for select boxes i. e. are stored in other tables.

relations {

mm {

tx_ships_main {

tx_ships_main_g3_application_mm = tx_ships_application

tx_ships_main_a3_boilerconstructor_mm = tx_ships_boilerconstructor

tx_ships_main_g7_class_mm = tx_ships_class

tx_ships_main_a2_engineconstructor_mm = tx_ships_engineconstructor

tx_ships_main_a2_enginesystem_mm = tx_ships_enginesystem

tx_ships_main_g7_material_mm = tx_ships_material

tx_ships_main_g2_shipowner_mm = tx_ships_owner

tx_ships_main_g3_powersystem_mm = tx_ships_powersystem

tx_ships_main_g3_rigortype_mm = tx_ships_rigortype

}

}

}

We will publish the extension ships too but later. The extension ships is a backend extension really, It hasn't any frontend possibility. All datas are delivered to the frontend by this extension Browser.

SQL Functions

The Browser Tutorial Database (en) is extended with three functions in context with SQL:

  • clean up
  • synonyms
  • hierarchical

All three functions are developed for using the database of the extension "Virtual Civil Services" :sup:`0 <#sdfootnote2sym>`_ (extKey: civserv). And all three are useful for every other database of any extension too.

Step 1: Synonyms

You can use synonyms for your data.

  • You can use a synonym of a field of your choice for the whole value only.
  • The value of the synonym needs its own field.
  • The amount of fields for synonyms is unlimited.
  • You have to configure the SQL statement in TypoScript in the manual mode.

Example for the structure in the database table tx_civserv_service:

Frame4

TypoScript

You find the TypoScript in res/tutorial_01/step_01.txt

plugin.tx_browser_pi1 {

views {

list {

1 {

select = sv.uid AS 'sv.uid', sv.sv_name AS 'sv.sv_name'

from {

table = tx_civserv_service

alias = sv

}

andWhere = sv.pid IN (###PID_LIST###)

aliases {

tables {

sv = tx_civserv_service

}

fields {

uid = sv.uid

sv_name = sv.sv_name

}

}

functions {

synonym = 1

synonym {

andSelect = 'synonym_value' AS 'sv.synonym_alias'

for {

table_field = sv.sv_name

noTrimWrap = | (= |)|

}

csvTableFields = sv.sv_synonym1, sv.sv_synonym2, sv.sv_synonym3

synonym_value = synonym_value

synonym_alias = synonym_alias

andWhere = AND synonym_alias != ''

}

clean_up {

csvTableFields = sv.synonym_alias

}

}

}

}

}

}

We have an example in the screen shot above with the record 478, which has one name and three synonyms:

  • uid: 478
  • sv_name: Schwerbehindertenfeststellung
  • sv_synonym1: Schwerbehindertenausweis
  • sv_synonym2: Schwerbehindertenangelegenheiten
  • sv_synonym3: Versorgungsamt

We will have the following list in the frontend with the TypoScript from above:

Frame4

Because of the sword is we have only results with the string part "Schwerbehindert".

Step 2: Hierarchical Order

The Browser Tutorial Database (en) can order datas hierarchical. It is a function, which optimized the Browser Tutorial Database (en) for teamwork with or using the database of the extension "Virtual Civil Services" (extKey: civserv).

Frame4

There is the condition precedent to the following database structure:

table_data.uid <-> uid_local.table_mm.uid_foreign <-> uid.table_data

Or in simplified SQL (without any TYPO3 needs):

SELECT table_data.uid, table_data.title

FROM table_data

LEFT JOIN table_mm

ON table_data.uid = table_mm.uid_local

LEFT JOIN table_data AS table_data2

ON table_data2.uid = table_mm.uid_foreign

TypoScript

You find the TypoScript in res/tutorial_01/step_02.txt

plugin.tx_browser_pi1 {

views {

list {

1 {

template < plugin.tx_browser_pi1.template

template {

file = EXT:browser/res/extensions/civserv/res/organisation.tmpl

}

select = or.uid AS `or.uid`, or.or_name AS `or.or_name`

from {

table = tx_civserv_organisation

alias = or

}

andWhere = or.pid IN (###PID_LIST###)

joins {

0 {

type = LEFT JOIN

table = tx_civserv_organisation_or_structure_mm

alias = or_or2

on = or.uid = or_or2.uid_local

}

1 {

type = LEFT JOIN

table = tx_civserv_organisation

alias = or2

on = or2.uid = or_or2.uid_foreign AND or2.pid IN (###PID_LIST###)

}

}

aliases {

tables {

or = tx_civserv_organisation

or2 = tx_civserv_organisation

or_or2 = tx_civserv_organisation_or_structure_mm

}

fields {

uid = or.uid

pid = or2.pid

}

}

functions {

hierarchical = 1

hierarchical {

andSelect = or2.uid AS `or.pid`

order_tableField = tx_civserv_organisation.or_name

wrap_tableField =

<span class="tx-browser-pi1 tx-browser- pi1-level-###LEVEL###">|</span>

display_root = 0

}

clean_up {

csvTableFields = or.pid

}

}

}

}

}

}

The Generated SQL Query

If you like to imagine the power of the Browser, please take a look in the generated SQL query:

SELECT or.uid AS `or.uid` , or.or_name AS `or.or_name`,

or2.uid AS `or.pid`

FROM tx_civserv_organisation AS `or`

LEFT JOIN tx_civserv_organisation_or_structure_mm AS `or_or2`

ON ( or.uid = or_or2.uid_local )

LEFT JOIN tx_civserv_organisation AS `or2`

ON

(

or2.uid = or_or2.uid_foreign

AND or2.pid IN

(

1094, 1153, 1146, 1152, 1151, 1150, 1149, 1148, 1147, 1140, 1145, 1144, 1143, 1142, 1141,1129, 1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1120, 1128, 1127, 1126,1125, 1124, 1123, 1122, 1121, 1113, 1119, 1118, 1117, 1116, 1115, 1114, 1104, 1112, 1111,1110, 1109, 1108, 1107, 1106, 1105, 1100, 1103, 1102, 1101, 1096, 1099, 1098, 1097, 1095,1091, 1093, 1092, 1090, 1089, 1082, 1088, 1087, 1086, 1085, 1083, 1084, 1081, 1078, 1080,1079, 1077

)

AND or2.deleted =0

AND or2.hidden =0

AND

(

or2.fe_group = ''

OR or2.fe_group IS NULL

OR or2.fe_group = '0'

OR

(

or2.fe_group LIKE '%,0,%'

OR or2.fe_group LIKE '0,%'

OR or2.fe_group LIKE '%,0'

OR or2.fe_group = '0'

)

OR

(

or2.fe_group LIKE '%,-1,%'

OR or2.fe_group LIKE '-1,%'

OR or2.fe_group LIKE '%,-1'

OR or2.fe_group = '-1'

)

)

)

WHERE or.deleted =0

AND or.hidden =0

AND

(

or.fe_group = ''

OR or.fe_group IS NULL

OR or.fe_group = '0'

OR

(

or.fe_group LIKE '%,0,%'

OR or.fe_group LIKE '0,%'

OR or.fe_group LIKE '%,0'

OR or.fe_group = '0'

)

OR

(

or.fe_group LIKE '%,-1,%'

OR or.fe_group LIKE '-1,%'

OR or.fe_group LIKE '%,-1'

OR or.fe_group = '-1'

)

)

AND or.pid IN

(

1094, 1153, 1146, 1152, 1151, 1150, 1149, 1148, 1147, 1140, 1145, 1144, 1143, 1142, 1141, 1129,1139, 1138, 1137, 1136, 1135, 1134, 1133, 1132, 1131, 1130, 1120, 1128, 1127, 1126, 1125, 1124,1123, 1122, 1121, 1113, 1119, 1118, 1117, 1116, 1115, 1114, 1104, 1112, 1111, 1110, 1109, 1108,1107, 1106, 1105, 1100, 1103, 1102, 1101, 1096, 1099, 1098, 1097, 1095, 1091, 1093, 1092, 1090,1089, 1082, 1088, 1087, 1086, 1085, 1083, 1084, 1081, 1078, 1080, 1079, 1077

)

LIMIT 0, 30

orderBy

orderBy is different from the SQL orderBy statement.

If you are using orderBy in your TypoScript, your statement won't be used in the SQL query, but will be used for ordering records with the php method array_multisort.

This has several advantages.

A better performance.

The Browser needs one query for data only.

It is possible to order children records too. See the example below:

Local table (parent)

TypoScript snippet

plugin.tx_browser_pi1.views.list {

1 {

select = ...

orderBy (tx_organiser_cal_mm_calentrance.sorting,tx_organiser_ca lentrance.title)

}

}

Comment

We have this relation in the example above (you can't see it):

tx_organiser_cal -> tx_organiser_cal_mm_calentrance -> tx_organiser_calentrance

It is like:

event -> mm table -> entrance fees

The orderBy clause from above will have the effect, that the titles of the entrance fees (values like: "students 10 EUR, adults 16 EUR, ..." will first ordered by the values of the field sorting in the mm table and second will be ordered by the title.

The browser detects a context between mm tables and foreign tables!

And the orderBy clause from above will have any effect to all other children tables.

Reference

See the reference in the Browser manual. See views.list order By and views.single orderBy.

Foreign table (children)

Screen shots

Frame4 Frame4

Illustration above:

  • The local table – the parent – is tx_org_headquarters.

    Values (titles) from this table are

    • Standort Schnellerstraße
    • Standort Belforter Straße
  • The foreign table – the children – is tx_org_departments.

    The titles of the departments are ordered manually in the backend (see illustration above).

If you like to get the same order of the children in the frontend, you need a SQL query. See the TypoScript below.

TypoScript snippet

plugin.tx_browser_pi1 {

views {

list {

501 = Headquarters

501 {

name = Standorte

showUid = headquartersUid

select (

tx_org_headquarters.title,

tx_org_headquarters.mail_postcode,

tx_org_headquarters.mail_city,

tx_org_headquarters.mail_address,

tx_org_department.title,

tx_org_headquarters.image,

tx_org_headquarters.imageseo

)

orderBy = tx_org_headquarters.sorting

orderBy {

tx_org_department (

SELECT tx_org_department.uid AS 'uid',

tx_org_department.title AS 'title'

FROM tx_org_department,

tx_org_headquarters_mm_tx_org_department

WHERE tx_org_headquarters_mm_tx_org_department.uid_local =###UID_LOCAL###

AND tx_org_headquarters_mm_tx_org_department.uid_foreign =tx_org_department.uid

ORDER BY tx_org_headquarters_mm_tx_org_department.sorting

)

}

csvLinkToSingleView = tx_org_headquarters.title

}

}

}

}

Comment

You control the ordering with the TypoScript property orderBy."foreignTable". foreignTable is the name of the foreign table like tx_org_department.

See from line 18 to line 27.

Be aware:

  • orderBy."foreignTable" is real SQL. It will be send as a SQL query directly – in contrast to orderBy for the local table above.
  • Because of a restriction of the TYPO3 API it isn't possible to create complex SQL queries: You are allowed to use one table in the SELECT only!
Reference

See the reference in the Browser manual. See views.list orderBy."foreignTable" and views.single orderBy."foreignTable".

What's new in Version 3.6?

Simple relations: Configurable foreign table field

See section "Simple Relation with configured Relation Field" on page 16 above.

Helpful suggestions

Forum

img-8 Illustration 24: The TYPO3-Frontend-Engine Browser Forum

The Browser has its own forum. We speak English and German. You are welcome to post any question, bug or snippet code at

TYPO3-Frontend-Engine Browser: Forum http://typo3-browser-forum.de/

Credits

netresearch

Thanks to

Christian WeiskeNetresearch GmbH & Co.KG http://www.netresearch.de/

who had developed the feature "Simple relations: Configurable foreign table field"

To-Do List

Nothing to do.

Change Log

3.6.3 New Feature * 13803: Ordering children records

3.6.0 New Feature * 11650: Simple relations: Configurable foreign table field. Thanks to cweiske

3.4.3 New Feature * 9727: Order children records in a single view by mm sorting

3.0.3 Bugfixing* Examples in Comments for single-relation and mm-relation had wrong syntax.

3.0.2 Maintenance* No extension dependency, no extension suggestion

3.0.1 Publishing

Illustration Index

Illustration 1: Tutorial in PDF format 3

Illustration 2: Relation between be_users and be_groups 4

Illustration 3: Relation between tt_news and tt_news_cat 4

Illustration 4: be_users and be_groups has a simple relation 5

Illustration 5: tt_news and tt_news_cat has a MM relation 6

Illustration 6: Any relation needs one record. 6

Illustration 7: Table Relations in the plugin. 8

Illustration 8: Startingpoint with a link to the sysfolder fe_user 8

Illustration 9: Frontend users with groups 9

Illustration 10: Display records without any pid 9

Illustration 11: Backend users with groups 10

Illustration 12: Startingpoint with a link to the sysfolder news 11

Illustration 13: Backend users with groups 11

Illustration 14: Table Relations in the plugin. 12

Illustration 15: The TypoScript array for auto relation building. 13

Illustration 16: The messages for auto relation building in the DRS. 13

Illustration 17: Only TypoScript 14

Illustration 18: Only TypoScript 17

Illustration 19: Table tx_civserv_service with name and three synonyms 19

Illustration 20: Synonyms in the Frontend - every synonym will be a result. 20

Illustration 21: Example for datas in hierarchical order 21

Illustration 22: Frontend with ordered children records 25

Illustration 23: Backend with ordered children records 25

Illustration 24: The TYPO3-Frontend-Engine Browser Forum 29

0 The extension "Organiser: Events & Stuff & News & More" (extKey: organiser) is under development. We scheduled the publishing in the TYPO3 repository for February 2011.

0 "Virtual Civil Services" is called "O.S.I.R.I.S" too.

33