2014-10-02 47 views
0

我開始與tx_news TYPO3擴展我的「冒險」。我創建了新的列表模板,並在下拉列表中看到了它的彈性 - 沒關係,但是如何僅使用TypoScript選擇該模板?可能嗎?如何使用TypoScript選擇tx_news列表模板

感謝您的任何幫助。

回答

1

我想通了。這裏是解決方案 - 如果你在你的模板都有,Typo腳本與99號(在tx_news教程)<f:if condition="{settings.templateLayout} == 99">的templateLayout您應使用此代碼來調用99佈局:

lib.some_news < lib.news 
lib.some_news = USER 
lib.some_news { 
userFunc = tx_extbase_core_bootstrap->run 
extensionName = News 
pluginName = Pi1 

switchableControllerActions.News.1 = list 

settings < plugin.tx_news.settings 
settings { 
    categories = 7 
    templateLayout = 99 # your layout number 
    limit = 1 
    detailPid = 22 
    overrideFlexformSettingsIfEmpty := addToList(detailPid) 
    startingpoint = 20 
    list { 
    media { 
     image { 
     maxWidth = 588 
     maxHeight = 428 
     width = 588c 
     height = 428c 
     } 
    } 
    } 
} 
} 
0

我得到以下錯誤,當使用你的腳本。

找不到鍵值爲「TYPO3 \ CMS \ Fluid \ ViewHelpers \ SwitchViewHelper-> switchExpression」的值,因此無法刪除密鑰。

我也檢查了手冊以及(http://docs.typo3.org/typo3cms/extensions/news/Main/Tutorial/IntegrationWithTs/Index.html),而且這種剪切似乎不能正常工作。

這可能會解決這個問題:https://forge.typo3.org/issues/59255

+0

回答你的問題我需要看到你的相關流體模板。無論如何,這與上面的腳本無關 - 所以如果你需要流體代碼的幫助,它可能是最好的問一個新的問題(如果它不存在) – 2016-05-23 06:47:03

1

只需3個步驟。

1)從EXT文件夾中的網站模板複製tepmlate並添加Typo腳本

plugin.tx_news { 
    view { 
     # Additional template paths 
     templateRootPaths.110 = youPath/Templates/ 
     # Additional partial paths 
     partialRootPaths.110 = youPath/Partials/ 
     # Different template for pagination 
     widget.Tx_News_ViewHelpers_Widget_PaginateViewHelper.templateRootPath = youPath/Templates/ 
    } 
} 

2)複製局部模板新的「新聞」模板中。比如複製部分/列表以局部模板/最近的(對於爲例) 3)現在你shood寫入規則脫穎而出模板「youPath /模板/ List.html」或/和相同的前Detail.html(如果需要)

<!-- Strat template --> 
<f:section name="content"> 

    <f:if condition="{settings.templateLayout}"> <!-- if we heve Layout than include our new partitial --> 

     <f:then> 

      <f:render partial="{settings.templateLayout}/List" arguments="{news: news, settings:settings}"/> 

     </f:then> 

     <f:else> 
<!-- ... default Template--> 

就是這樣)祝你好運