[英]TYPO3: Fluid inserted menu has no items
I try to learn and understand Fluid based TYPO3 site packages better and roughly followed this tutorial: TYPO3 Sitepackage Tutorial .我尝试更好地学习和理解基于 Fluid 的 TYPO3 站点包,并大致遵循了本教程: TYPO3 站点包教程。 I deviated from it in a few points though, to keep it simple (I omitted everything related to Jumbotron and substituted it with a simpler menu of my own creation.不过,为了保持简单,我在几点上偏离了它(我省略了与 Jumbotron 相关的所有内容,并用我自己创建的更简单的菜单代替它。
This is the partial I generated for the menu:这是我为菜单生成的部分:
<div class="mainmenu">
*
<f:for each="{mainnavigation}" as="mainnavigationItem">
<span class="nav-item {f:if(condition: mainnavigationItem.active, then: 'active')}">
<a class="nav-link"
href="{mainnavigationItem.link}"
target="{mainnavigationItem.target}"
title="{mainnavigationItem.title}"
>
{mainnavigationItem.title}
</a>
</span>
</f:for>
*
</div>
My site package actually works to some extend and I could generate a main page and some sub pages with it.我的站点 package 实际上在一定程度上可以工作,我可以用它生成一个主页和一些子页面。 Unfortunately my menu items/sub pages links are not shown though.不幸的是,我的菜单项/子页面链接没有显示。 They are not added to the menu.它们不会添加到菜单中。 It seems that the MenuProcessor object is empty.似乎 MenuProcessor object 是空的。 I know the respective partial is actually rendered, because I can see static parts included in the page, but nothing else.我知道相应的部分实际上已呈现,因为我可以看到页面中包含 static 个部分,但没有别的。 In short: The for-loop does not produce anything.简而言之:for 循环不产生任何结果。 I assume there are no "mainnavigationItems" found for some reason.我假设由于某种原因没有找到“mainnavigationItems”。 Maybe I am just missing a simple setting somewhere, that has nothing to do with Fluid or sitepackages.也许我只是在某处遗漏了一个简单的设置,它与 Fluid 或站点包无关。
Here's the code for my setup.typoscript file:这是我的setup.typoscript文件的代码:
@import 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript'
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = pagelayout
pagets__site_package_default = TEXT
pagets__site_package_default.value = Default
default = TEXT
default.value = Default
}
templateRootPaths {
0 = EXT:site_package/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:site_package/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:site_package/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 1
includeSpacer = 1
as = mainnavigation
}
}
}
includeCSS {
website = EXT:site_package/Resources/Public/Css/look.css
}
includeJSFooter {
website = EXT:site_package/Resources/Public/JavaScript/myscript.js
}
}
config {
absRefPrefix = auto
cache_period = 86400
debug = 0
disablePrefixComment = 1
doctype = html5
extTarget =
index_enable = 1
index_externals = 1
index_metatags = 1
inlineStyle2TempFile = 1
intTarget =
linkVars = L
metaCharset = utf-8
no_cache = 0
pageTitleFirst = 1
prefixLocalAnchors = all
removeDefaultJS = 0
sendCacheHeaders = 1
// Compression and concatenation of CSS and JS Files
compressCss = 0
compressJs = 0
concatenateCss = 0
concatenateJs = 0
}
Do you have any ideas, why my menu shows no items?你有什么想法,为什么我的菜单没有显示任何项目? Thank you for your time!感谢您的时间!
I figured something out by myself: It seems I cannot place the menu in a partial.我自己想出了一些办法:看来我不能将菜单放在一个部分中。 I integrated that part in the main layout template instead and now the menu items are listed.我将该部分集成到主布局模板中,现在列出了菜单项。
I can only assume, that some kind of information is not automatically passed forward to where it would be needed, when the partial file is rendered.我只能假设,当呈现部分文件时,某种信息不会自动传递到需要它的地方。
I think you have to add a starting point or a list of pages to your typoscript.我认为您必须在打字稿中添加起点或页面列表。
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 1
special = list
special.value = 1,2,3,4
# or
special = directory
special.value = 3
includeSpacer = 1
as = mainnavigation
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.