Additional page property fields in TYPO3 CMS 6.2

…衆ロ難τιáo~ 提交于 2019-12-04 20:13:37

There are several approaches:

  1. The "vanilla" approach:

Create an extension (and with it the file ext_emconf.php) and then create a file ext_tables.sql in the extension root. In it you can put SQL-definitions for the new fields, by defining a CREATE TABLE statement for the pages table:

CREATE TABLE pages(
    myNewField int(11) DEFAULT '',
);

This SQL-definition will be merged with existing definitions for the table page.

Then you need to configure the new field in the Table Configuration Array (TCA). You can usually find good examples in existing extensions, for example in realurl. There are two places where you can put these definitions, either in the file ext_tables.php (uncached), or into a php file in the folder Configuration/Tca/Overrides (cached).

This approach sounds like more work than it actually is.

  1. Just use TemplaVoila. It is available for TYPO3 6.2, but its future is uncertain, AFAIK.

  2. Use the fluidtypo3-Ecosystem of extensions, and especially the extension fluidpages. It does what you want, in a similar way to TemplaVoila, but with modern (= fluid-based) technologies.

if you need your own custom content elements, i recommend the extension "DCE" (Dynamic Content Elements).

DCE is really easy to customise and you can create Content elements in some minutes.


Also you can do it like Jost said. Do it with an own extension and put the TCA definition in your extTables.php

As example:

/www/htdocs/website/typo3conf/ext/custom_extension/ext_tables.php

$tmp_itm_extended_columns_pages = array(
    'link_class' => array(
        'exclude' => 0,
        'label' => 'LLL:EXT:itm_extended/Resources/Private/Language/locallang_db.xlf:label.linkClass',
        'config' => array(
            'type' => 'select',
            'items' => array(
                array('Nichts', ''),
                array('Zahnrad', 'icon-afford', 'EXT:custom_extension/Resources/Public/img/icons/icon_preferences_small.png'),
                array('Fabrik', 'icon-factory', 'EXT:custom_extension/Resources/Public/img/icons/icon_factory_small.png'),
                array('Computer', 'icon-software', 'EXT:custom_extension/Resources/Public/img/icons/icon_software_small.png'),
                array('Person', 'icon-jobs', 'EXT:custom_extension/Resources/Public/img/icons/icon_person_small.png'),
                array('Welt', 'icon-world', 'EXT:custom_extension/Resources/Public/img/icons/icon_world_small.png'),
                array('Rohre', 'icon-pipe', 'EXT:custom_extension/Resources/Public/img/icons/icon_pipe_small.png'),
            ),
        ),
    ),
);

Then you have to add your new field to the ext_tables.sql

#
# Table structure for table 'pages'
#
CREATE TABLE pages (

    link_class text

);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!