[英]Typo3 HMENU in Partials not showing
i am trying to create an header in my partials folder, but actually it doesn't showed up if i am trying to insert it into my template. 我正在尝试在我的partials文件夹中创建标题,但是如果我尝试将其插入模板中,则实际上它没有显示。
My setup.ts file looks as follow: 我的setup.ts文件如下所示:
page = PAGE
page {
200 = FLUIDTEMPLATE
200 {
file = fileadmin/private/templates/home/template.html
partialRootPath = fileadmin/private/partials
layoutRootPath = fileadmin/private/layouts/home
....
In my Layout.html file i am try to include the Header partial with the section "test" as follows: 在我的Layout.html文件中,我尝试将Header部分包含在“ test”部分中,如下所示:
<div>
<f:render partial='Header' section='test' />
</div>
The Header partial file is written as below: 标头部分文件的编写如下:
<f:section name="test">
<ul class="flexnav" data-breakpoint="800">
<f:cObject typoscriptObjectPath="lib.navbar" />
</ul>
The "lib.navbar" is declared in my object.ts file: 在我的object.ts文件中声明了“ lib.navbar”:
lib.navbar = HMENU
lib.navbar {
entryLevel = 1
1 = TMENU
1 {
wrap = <ul class="test1"> | </ul>
NO = 1
expAll = 1
NO {
wrapItemAndSub = <li> | </li>
stdWrap.htmlSpecialChars = 1
ATagTitle.field = title
}
ACT <.NO
ACT {
wrapItemAndSub = <li class="active"> | </li>
}
}
2 = TMENU
2 {
expAll = 1
wrap = <ul> | </ul>
NO {
wrapItemAndSub = <li> | </li>
}
}
My problem is now, that i cannot use the variable lib.navbar in my templates. 现在的问题是,我无法在模板中使用变量lib.navbar。 It is always empty. 它总是空的。 Does anyone know what i am doing wrong here? 有人知道我在这里做错了吗?
You can either use partial
or section
attribute in <f:render />
. 您可以在<f:render />
使用partial
或section
属性。
Try to use: <f:render partial="Header" />
and remove the section in your partial. 尝试使用: <f:render partial="Header" />
并删除您的局部中的部分。
You need to use f:section
like below. 您需要使用如下的f:section
。
<f:render section="test" />
<f:section name="test">
<ul class="flexnav" data-breakpoint="800">
<f:cObject typoscriptObjectPath="lib.navbar" />
</ul>
</f:section>
I tried your example TYPO3 Developer and i the the following exception: In the browser: 我尝试了示例TYPO3 Developer ,但出现以下异常:在浏览器中:
In the log file: Oops, an error occurred! 在日志文件:糟糕,发生错误! Code: 20170824201947e83f7738 编码:20170824201947e83f7738
Thu, 24 Aug 2017 20:19:25 +0200 [ALERT] request="d6a9827573124" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! 2017年8月24日,星期四20:19:25 +0200 [ALERT] request =“ d6a9827573124” component =“ TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler”:糟糕,发生了错误! Code: 20170824201925a92fa27d - {"exception":"TYPO3Fluid\\Fluid\\View\\Exception\\InvalidSectionException: Section \\"test\\" does not exist. in /opt/lampp/htdocs/typo3/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php:253 代码:20170824201925a92fa27d-{“ exception”:“ TYPO3Fluid \\ Fluid \\ View \\ Exception \\ InvalidSectionException:部分\\” test \\“不存在。在/ opt / lampp / htdocs / typo3 / vendor / typo3fluid / fluid / src / View / AbstractTemplateView.php:253
I tried also to copy/paste the section in the layout file but it also hasn't work. 我也尝试将部分复制/粘贴到布局文件中,但是它也没有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.