如果我想在 Fluid 模板中使用 TypoScript 生成菜单,有两种可能的方法:
use the TypoScript to fill a variable for the template. doing it like this:
page.10 = FLUIDTEMPLATE page.10 { templateName = index.html // ... define pathes ... variables { contentMain < styles.content.get mainMenu < temp.mainMenu : } }
and in the template just use the variable:
<div class="header"> <div class="logo">{logo->f:format.raw()}</div> <div class="main-menu">{mainMenu->f:format.raw()}</div> </div>
the other way is the usage of the f:cObject ViewHelper to call a part of TypoScript.
the TypoScript:page.10 = FLUIDTEMPLATE page.10 { templateName = index.html // ... define pathes ... variables { contentMain < styles.content.get : } } lib.mainMenu < temp.mainMenu
while the Fluid template looks like this:
<div class="header"> <div class="logo">{logo->f:format.raw()}</div> <div class="main-menu"> <f:cObject typoscriptObjectPath="lib.mainMenu /> </div> </div>
那么,我的问题是:每种方式的优缺点是什么?
这些方法在不同版本的TYPO3中有何差异?