2016-01-05 13 views
0

我需要在新聞(和一些TYPO3)上急速課程。我想要進一步「顯示什麼」插件選項,以顯示自定義的新聞列表。。我如何定義一個新的列表視圖?

我(相信)瞭解如何在類newsController中定義一個新的mylistAction方法,以及相應的mylist.html模板。

我想念的是如何在BE模塊中獲得(工作)mylist選項以將插件插入到頁面中。 我不知道還有什麼我需要更新,以及如何(TCA,語言文件,TS,...)

感謝您的幫助,乾杯,馬里奧

----- 編輯求助 我做到了!

  • 我定義的動作listmAction()NewsController.php
  • 我內Configuration/Flexforms/flexform_news.xml我添加的行定義的模板listm.html
  • <numIndex index="22"> 
    <numIndex index="0">LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm 
    </numIndex> 
    <numIndex index="1">News->listm</numIndex> 
    </numIndex>
  • locallang_be.xlf我添加的行

    <trans-unit id="flexforms_general.mode.news_listm" xml:space="preserve"> 
    <source>List m view</source> 
    </trans-unit>

現在我可以插入一個新聞插件到
新listm選項,並呈現listm模板。 (看來我也需要垃圾緩存)。好!

回答

0

如果你想插入插件到頁面中,你需要爲它創建自定義的前端插件。喜歡的東西

ext_tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'Namespace.' . $_EXTKEY, 
    'custom_news', 
    'Custom News' 
); 

ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Namespace.' . $_EXTKEY, 
    'custom_news', 
    array('CustomNews' => 'mylist'), 
    // non-cacheable actions 
    array('CustomNews' => 'mylist') 
); 

我希望你創建自定義擴展爲它和擴展newsController。

問候,安東

1

這是一個壞主意,修改新聞延伸 - 你真的不能事後更新。

但是,EXT:新聞有內置的方式來添加多個列表視圖,documented here

短版本:新聞插件中有一個模板選擇器,您可以通過TypoScript向其添加項目。把這樣的事情在你的佩吉特氏:

tx_news.templateLayouts { 
    1 = A custom layout 
    99 = LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode.news_listm 
} 

您在這一領域的後端所做的選擇傳遞給意見變量settings.templateLayout

所以在你List.html模板文件,你可以這樣做:

<f:if condition="{settings.templateLayout} == 99"> 
    <f:then> 
     <!-- Render template with number 99 here --> 
    </f:then> 
    <f:else> 
     <!-- Render template with number 1 here --> 
    </f:else> 
</f:if> 

如果你有多個模板,它是使用the switch/case-ViewHelpers from EXT:vhs或類似的東西是個好主意。

+0

謝謝。如果我希望新的mylistAction,該怎麼辦?有沒有類似的伎倆? – mario

相關問題