0
votes

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?

3
first, I think you can remove the wrap = <ul class="test1"> | </ul> as you already have another <ul> in your partial file. My first question: If you put in your TypoScript Template page.199 < lib.navbar does it output the menu? - Riccardo De Contardi

3 Answers

0
votes

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.

0
votes

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>
0
votes

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.