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.
My setup.ts file looks as follow:
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:
<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:
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. It is always empty. Does anyone know what i am doing wrong here?
You can either use partial
or section
attribute in <f:render />
.
Try to use: <f:render partial="Header" />
and remove the section in your partial.
You need to use f:section
like below.
<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:
In the log file: Oops, an error occurred! Code: 20170824201947e83f7738
Thu, 24 Aug 2017 20:19:25 +0200 [ALERT] request="d6a9827573124" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! 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
I tried also to copy/paste the section in the layout file but it also hasn't work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.