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.

EXT: API to list tables in the Web->Page module

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Holzinger Franz
Changed:2010-07-03T13:00:52
Classification:patch1822
Keywords:forEditors, forDevelopers, forIntermediates, page module
Author:Franz Holzinger
Email:franz@ttproducts.de
Info 4:
Language:en

img-1 img-2 EXT: API to list tables in the Web->Page module - patch1822

EXT: API to list tables in the Web->Page module

Extension Key: patch1822

Language: en

Keywords: forEditors, forDevelopers, forIntermediates, page module

Copyright 2010, Franz Holzinger, <franz@ttproducts.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

EXT: API to list tables in the Web->Page module 1

`Introduction 3 <#1.1.Introduction|outline>`_

What does it do? 3

Screenshots 3

`Users manual 4 <#1.2.Users%20manual|outline>`_

`Administration 5 <#1.3.Administration|outline>`_

Reference 5

`Known problems 7 <#1.4.Known%20problems|outline>`_

`To-Do list 8 <#1.5.To-Do%20list|outline>`_

`ChangeLog 9 <#1.6.ChangeLog|outline>`_

Introduction

What does it do?

This enhances the API in the Web-Page module of the TYPO3 backend for TYPO3 before 4.4. This can be used by other extensions give you user friendly views of the tables. See bug1822 . And this will also support the display of any table in the page module. Other tables are normally excluded from this. There is only a rudimentary API in TYPO3.

Screenshots

  • You will have many more items selectable in the menu and more columns containing more details for the products.

img-3

Users manual

Just install the extension together with any other extension which supports this patch. If you use tt_products, then you m,ust go into the Extension Manager and check to 'Use patch 1822'. Otherwise you will see no effect.

Be aware that this extension is using code based on XCLASS. Maybe it will make your TYPO3 page module unusable.

Administration

Insert a code like this example into the file localconf.php of your extension.The hook $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db _layout']['addTables'] can be used in your extensions to add new menu entries to the page module.Usage of this hook:$GLOBALS['TYPO3_CONF_V ARS']['EXTCONF']['cms']['db_layout']['addTables']['yourtablename'] ... where yourtablename is the name of the table which you want to be listed in the page module.Then you assign an associative array (key names of your choice – it is recommended to always use 'default' and 'ext') to it, which has again an array as the value.

Reference

Associative hook array

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['LLFile' ]['yourtablename']

This contains the path to the language file. Example:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['LLFile']['mytablename'] = 'EXT:myextkey/locallang.xml';

For static tables which have the page id=0 and should be displayed an the root page, you must add the additional hook array $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['page0'].

Example:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['page0']['mytablename'] = TRUE;

Associative hook array

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['yourtablename'] ['yourkey'].

Replace 'yourtablename' by the name of the database table of your extension.Replace 'yourkey' by any meaningfull keyname of your choice. You should at least use the keys 'default' and 'ext'.

fList

key field

fList

Data type

string

Description

Field list which is delimited by commas or semicolons. This defines how it will be displayed in the table view. A comma will create a new table columnand a semicolon will insert a new line inside of the same column

icon

key field

icon

Data type

boolean

Description

If true, the table's icon will be displayed in the first tab. It is recommended to set this always to TRUE.

[hook array $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layou t']['addTables']['yourtablename'] ['yourkey']]

Special values for 'yourkey':

'langArray' … array with the language code as key and a second array as value where an English field is the key and the translated field is the value. This will change the output from above in the way that the translated fields are shown in front of the English fields, but only if the backend user has selected this language as his preferred language.

((generated))
Example
if (t3lib_extMgm::isLoaded('static_info_tables_de'))       {
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['static_countries']['langArray'] = array('de' => array('cn_short_en' => 'cn_short_de'));
}
Example

This example enhances the page module's display of the tables tt_products (see image above), tt_products_articles and tt_products_cat.

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tt_products'] = array (
    'default' => array(
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_default',
            'fList' =>  'title,itemnumber,price,image',
            'icon' => TRUE
    ),
    'ext' => array (
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_ext',
            'fList' =>  'title,price2,category;inStock;weight;tax',
            'icon' => TRUE
    ),
    'variants' => array(
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_variants',
            'fList' =>  'title,color;size;gradings,description',
            'icon' => TRUE
    )
);

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tt_products_articles'] = array (
    'default' => array(
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_default',
            'fList' =>  'title,itemnumber,price,inStock',
            'icon' => TRUE
    ),
    'ext' => array(
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_ext',
            'fList' =>  'title;price2,color;size;gradings',
            'icon' => TRUE
    )
);

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tt_products_cat'] = array (
    'default' => array(
            'MENU' => 'LLL:EXT:tt_products/locallang.xml:m_default',
            'fList' =>  'title,image',
            'icon' => TRUE
    )
);
Image fields

If you have a field which is an image, then this will normally be shown as a text field with the name of the file. You can however activate the display of the image in the file ext_tables.php of your extension. In this example the column name of the image field is 'image'. Then you must add the 'thumbnail' assigned to the image's field name in the 'ctrl' section of the $TCA array of your table.

'thumbnail' => 'image'
Example
$TCA['tt_products'] = Array (
    'ctrl' => Array (
            'title' =>'LLL:EXT:'.TT_PRODUCTS_EXTkey.'/locallang_db.xml:tt_products',
            'label' => 'title',
            'label_alt' => 'subtitle',
            'default_sortby' => 'ORDER BY title',
            'tstamp' => 'tstamp',
            'prependAtCopy' => 'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy',
            'crdate' => 'crdate',
            'delete' => 'deleted',
            'enablecolumns' => Array (
                    'disabled' => 'hidden',
                    'starttime' => 'starttime',
                    'endtime' => 'endtime',
                    'fe_group' => 'fe_group',
            ),
            'thumbnail' => 'image',
            'useColumnsForDefaultValues' => 'category',
            'mainpalette' => 1,
            'dynamicConfigFile' => PATH_BE_ttproducts.'tca.php',
            'iconfile' => PATH_ttproducts_icon_table_rel.'tt_products.gif',
            'dividers2tabs' => '1',
    ),
    'feInterface' => Array (
            'fe_admin_fieldList' => 'title,subtitle,itemnumber,price,price2,note,category,address,inStock,tax,weight,bulkily,offer,highlight,directcost,color,size,description,gradings,unit,unit_factor,www,datasheet,special_preparation,image,hidden,starttime,endtime',
    )
);

Known problems

  • This has been developed with a XCLASS with code taken from TYPO3 4.2.1. Maybe it does not work with former or future versions of TYPO3.
  • You do not need this patch since TYPO3 4.4.

To-Do list

Add your comments to the patch in the Core list. See the comments on the bugtracker .

img-4

ChangeLog

See the file "ChangeLog"

9