2014-10-01 58 views
1

在TYPO3 6.2中添加自定義頁面屬性字段的建議方法是什麼?
在4.5中,我使用了TemplaVoila,它有自己的頁面模塊,可以很容易地在頁面級添加數據記錄。TYPO3中的其他頁面屬性字段CMS 6.2

回答

2

有幾種方法:

  1. 的「香草」的方法:

創建一個擴展(與它的文件ext_emconf.php),然後創建在擴展根文件ext_tables.sql。在這裏面,你可以把SQL-定義爲新的領域,通過定義頁表CREATE TABLE聲明:

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

此SQL定義將與表page現有的定義進行合併。

然後您需要配置Table Configuration Array (TCA)中的新字段。您通常可以在現有擴展中找到很好的示例,例如realurl。有兩個地方可以將這些定義放在文件ext_tables.php(未緩存)或文件夾Configuration/Tca/Overrides(緩存)中的php文件中。

這種方法聽起來像比實際工作更多的工作。

  1. 只需使用TemplaVoila。它可用於TYPO3 6.2,但其未來還不確定,AFAIK。

  2. 使用fluidtypo3擴展的生態系統,特別是擴展fluidpages。它按照與TemplaVoila類似的方式進行,但採用現代(基於流體)技術。

+0

很有啓發,謝謝約斯特。 – Jpsy 2014-10-02 07:37:02

2

如果您需要自己的自定義內容元素,我推薦使用擴展名「DCE」(動態內容元素)。

DCE非常容易定製,您可以在幾分鐘內創建內容元素。


你也可以像Jost說的那樣做。用自己的分機做到這一點,把TCA定義你的extTables.php

作爲例子:

/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'), 
      ), 
     ), 
    ), 
); 

然後你有你的新字段添加到ext_tables.sql

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

    link_class text 

); 
+0

謝謝克里斯。我意識到DCE,但我的問題是頁面級配置。無論如何,對於TCA和SQL樣本來說,你的答案已經很好地滿足了Jost的答案。 – Jpsy 2014-10-02 07:39:29