Using the Dataprocessor from TYPO3 8 - typo3

I try to use the dataprocessor from TYPO3 8 to make my menu.
I have this code in my TypoScript script:
page = PAGE
page{
10 = FLUIDTEMPLATE
10 {
file = fileadmin/abis/templates/BootstrapTmpl.html
partialRootPath = fileadmin/abis/Partials/
layoutRootPath = fileadmin/abis/Layouts/
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
entryLevel= 0
excludeUidList = 27,30,31
levels = 5
#includeSpacer = 1
titleField = nav_title // title
as = huhu
}
}
...
}
And this one in a section:
<f:section name="myMenu" >
<f:debug title="title">{huhu}</f:debug>
<f:cObject typoscriptObjectPath="obj.logo" />
<ul class="nav navbar-nav navbar-left">
<f:for each="{huhu}" as="menuItem">
<li>
{menuItem.text}
<f:if condition="menuItem.subItems">
<f:render section="myMenu" arguments="{myMenu: menuItem.subItems}" />
</f:if>
</li>
</f:for>
</ul>
</f:section>
My HTML output is empty. The variable {huhu} is empty. And I don't know why. Does anybody have an idea?

Try to put your dataProcessing into page.10:
page = PAGE
page {
10 = FLUIDTEMPLATE
10 {
file = fileadmin/abis/templates/BootstrapTmpl.html
partialRootPath = fileadmin/abis/Partials/
layoutRootPath = fileadmin/abis/Layouts/
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
entryLevel= 0
excludeUidList = 27,30,31
levels = 5
#includeSpacer = 1
titleField = nav_title // title
as = huhu
}
}
}
}

First, the "dataProcessing" has to be done inside page.10. And second you have to give your arguments over to your section in the "f:render" tag. Don't know if you do that, because that part is missing in your example code.

I had a similar problem and my typoscript code was correct. However, I forgot to add
arguments="{_all}"
when calling
<f:render partial="header" arguments="{_all}" />
in my layout.
You can also use <f:debug>{huhu}</f:debug> in your Partial, if huhu is null you might have forgotten about the arguments="{_all}".

Related

TYPO3 - FilesProcessor - print out image tag in FLUID Template

I want to read out the "images" from a content element with FilesProcessor.
But I can't get the files array filled
In the TYPO3-Backend I add an image to the content element:
My TypoScript:
// Part 1: Fluid template section
page.10 = FLUIDTEMPLATE
page.10 {
templateName = TEXT
templateName {
cObject = TEXT
cObject {
data = pagelayout
required = 1
case = ucfirst
split {
token = pagets__
cObjNum = 1
1.current = 1
}
}
ifEmpty = 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}
}
}
page.10 {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 1
includeSpacer = 1
as = mainnavigation
}
20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
20 {
table = tt_content
orderBy = sorting
where = colPos = 1
as = jumbotronContent
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
as = images
reference.fieldName = image
}
}
}
}
}
My Jumbotron-Content-Element HTML-Template:
<f:debug title="all" inline="true">{_all}</f:debug>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<section class="hero">
<div class="d-flex container">
<div class="d-flex flex-column justify-content-center">
<f:for each="{jumbotronContent}" as="Jumbotron" iteration="iter">
<h1>{Jumbotron.data.header}</h1>
<h2>{Jumbotron.data.subheader}</h2>
<button>SABER MAIS AGORA</button>
</f:for>
</div>
<div class="hero-image d-flex justify-content-center">
<f:for each="{images}" as="image">
<f:debug>{image}</f:debug>
<f:image image="{image.originalFile}"/>
</f:for>
</div>
</div>
</section>
</html>
But the f:debug-Viewhelper tells me
images => array(empty)
How can I fill the image array? I probably put the FilesProcessor code on the wrong place.
Can someone plase assist.
Thank you
Your configuration has a typo: it should be references (plural):references.fieldName
page.10.dataProcessing.20.dataProcessing.10.references.fieldName = image

TYPO3 - How to display form in grid element?

I use TYPO3 v10.4.8 with the extension gridelements and the core form extension. I have included the form into my created grid element in the backend, but it's not visible in frontend. This is a part of my grid template:
<f:if condition="{children}">
<f:for each="{children}" as="columns" key="rowNumber">
<div class="row grid-row grid-row-{rowNumber}">
<f:if condition="{columns}">
<f:for each="{columns}" as="column" key="columnNumber">
<div class="col-12 grid-column grid-column-{columnNumber}">
<f:for each="{column}" as="child">
<div class="inner">
<f:cObject typoscriptObjectPath="tt_content.{child.data.CType}" data="{child.data}" table="tt_content" />
</div>
</f:for>
</div>
</f:for>
</f:if>
</div>
</f:for>
</f:if>
My configuration:
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateName.field = tx_gridelements_backend_layout
templateName.ifEmpty = GridElement
layoutRootPaths {
10 = EXT:gridelements/Resources/Private/Layouts/
20 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
10 = EXT:gridelements/Resources/Private/Partials/
20 = {$page.fluidtemplate.templateRootPath}
}
templateRootPaths {
10 = EXT:gridelements/Resources/Private/Templates/
20 = {$page.fluidtemplate.templateRootPath}
}
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
default {
as = children
options {
resolveChildFlexFormData = 0
}
}
}
}
}
The Render.html file from the core module is called, but the variable formConfiguration is empty, so no form is rendered.
Since a form element uses the pi_flexform field to select the form definition, you have to disable the automatic FlexForm resolver of Gridelements.
By default Gridelements with dataProcessing is meant to be rendering everything within a FLUID template by accessing variables and settings directly. So the default setting of the DataProcessor is to resolve FlexForm XML data into arrays.
To disable that behaviour you can use the option
resolveFlexFormData = 0
to disable it for a container and its children or
resolveChildFlexFormData = 0
to still resolve container FlexForms but skip those of child elements.

Is possible to make a site multilanguage in TYPO3 when your menu is static?

I want to include a nav-item in my static menu from where i can change the site language.
Here is an example how to create DataProcessor and how to handle it in Fluid templates.
TypoScript:
page.10 = FLUIDTEMPLATE
page.10 {
layoutRootPath = EXT:your_sitepackage/Resources/Private/Layouts/Page/
partialRootPath = EXT:your_sitepackage/Resources/Private/Partials/Page/
file = EXT:your_sitepackage/Resources/Private/Templates/Page/Default.html
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
entryLevel = 0
levels = 2
expandAll = 1
as = mainNav
}
20 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
20 {
special = directory
# This number is the sysfolder holding the header navigation pages
special.value = 11
as = headerNav
}
30 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
30 {
languages = auto
as = languageNav
}
40 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
40 {
special = directory
# This number is the sysfolder holding the footer navigation pages
special.value = 13
as = footerNav
}
}
}
In Fluid you get an array with all pages fetched by the different DataProcessors:
<f:if condition="{mainNav}">
<ul class="nav-main">
<f:for each="{mainNav}" as="item">
<li class="nav-main__item{f:if(condition: '{item.active}', then: ' nav-main__item-active')}">
<a href="{item.link}">
{item.title}
</a>
</li>
</f:for>
</ul>
</f:if>
Or the language menu:
<f:for each="{languageNav}" as="item">
<li class="language__item">
<f:if condition="{item.active}">
<f:then>
<span>{item.navigationTitle}</span>
</f:then>
<f:else>
{item.navigationTitle}
</f:else>
</f:if>
</li>
</f:for>
Of course you can choose your own classes and structure, but this possibility gives you a much easier integration.
Hope, it helps

TYPO3 v8.5 with Fluidtemplate and fluid-styled-content - Partials not working

I use TYPO3 v8.5 with fluid-templating (with layout, partials and template) and fluid-styled-content.
However, as soon as I create a fsc-element e.g. text&media on my site, the partial files are ignored and only the section from the template file is output in the FE.
If I set the content-element to "hide", then the correct site-structure with partials were output in the FE.
My root-template is:
page = PAGE
page.includeCSS {
main = fileadmin/Demo/Resources/Public/Css/main.css
}
page.10 = FLUIDTEMPLATE
page.10 {
layoutRootPaths {
10 = fileadmin/Demo/Resources/Private/Layouts
20 = fileadmin/Demo/Individual/Private/Layouts
}
partialRootPaths {
10 = fileadmin/Demo/Resources/Private/Partials
20 = fileadmin/Demo/Individual/Private/Partials
}
templateRootPaths {
10 = fileadmin/Demo/Resources/Private/Templates
20 = fileadmin/Demo/Individual/Private/Templates
}
variables {
contentMain < styles.content.get
}
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = pagelayout
default = TEXT
default.value = fileadmin/Demo/Resources/Private/Templates/DefaultTemplate.html
pagets__1 < .default
}
}
My page-TSconfig:
mod.web_layout.BackendLayouts {
1 {
title = Default Template
config {
backend_layout {
colCount = 1
rowCount = 1
rows {
1 {
columns {
1 {
name = Main Content
colPos = 0
}
}
}
}
}
}
}
}
DefaultLayout.html :
<f:render partial="Header"/>
<f:render section="Main"/>
<f:render partial="Footer"/>
Footer.html :
<div class="footer-container">
<footer class="wrapper">
Hier steht der Footer-Text
</footer>
</div>
Header.html :
<div class="header-container">
<header class="wrapper clearfix">
<h1 class="title">LOGO</h1>
<nav>
Hier erscheint die Navigation
</nav>
</header>
</div>
DefaultTemplate.html :
<f:layout name="DefaultLayout"/>
<f:section name="Main">
<div class="main-container">
<div class="main wrapper clearfix">
<article>
<f:format.raw>{contentMain}</f:format.raw>
</article>
</div>
</div>
</f:section>
Does anyone know this behavior and can give me a tip what's wrong with my code.
In TYPO3 v7.6 this code works fine.
There is currently an open bug (see https://forge.typo3.org/issues/77235) regarding this issue. Try to rename your Partials as a workaround until this is fixed.

TYPO3 - Custom page types not showing in menu

in my TYPO3 7.5 project I have created some custom page types by registering them in ext_tables.php as described further here
I can select those page types in the backend, no errors, all good. Also checking for a certain page-type via statements in the frontend works fine.
Now I want to create a menu of those (sub-)page trees. The TypoScript solution looks like this and works fine:
lib.tourTeasers = HMENU
lib.tourTeasers {
special = directory
wrap = <section class="row">|</section>
1 = TMENU
1 {
wrap = <div class="col-sm-12">|</div>
expAll = 1
NO {
doNotLinkIt = 1
linkWrap = <h2 style="text-align:right">Kategorie: |</h2>
}
}
2 = TMENU
2{
expAll = 1
NO{
doNotLinkIt = 1
linkWrap = <h3>Tourtyp: |</h3>
}
}
3 = TMENU
3{
NO{
doNotLinkIt = 1
linkWrap = <h4>|</h4>
after.cObject = COA
after.cObject {
stdWrap.dataWrap = <div class="row teaser">|</div>
10 = FILES
10 {
references {
table = pages
fieldName = media
}
renderObj=IMAGE
renderObj{
file{
width=300c
height=150c
#maxW=257c
#maxH=150c
import.data= file:current:publicUrl
}
altText.data = file:current:title
#altText.field=abstract
#titleText.field=nav_title
#stdWrap.dataWrap = |</a>
stdWrap.dataWrap(
<a href="index.php?id={field:uid}" title="Tour {field:title} ansehen">
<div class="col-sm-4 teaser__image">|</div>
</a>
)
params = class="img-responsive"
}
}
30 = TEXT
30.field = abstract // bodytext
30.crop = 250
30.wrap = <div class="col-sm-8 teaser__description"><p>|</p>
40 = TEXT
40.value = Ansehen
40.typolink.parameter.field = uid
40.typolink.ATagParams = class="btn"
40.wrap = <div class="button teaser__cta">|</div></div>
}
}
}
}
My problem is:
If I use the very Fluid Viewhelper that is intended to render exacly the same
<v:page.menu.directory pages="{page_uid}" as="tours" expandAll="true">
<f:for each="{tours}" as="tour">
<div class="row">
<div class="col-sm-3">
<v:page.resources.fal table="pages" field="media" uid="{tour.uid}" as="images">
<f:for each="{images}" as="image">
<f:image src="{image.url}" alt="{image.alternative} {image.name}" title="{image.title}" class="img-responsive"/>
</f:for>
</v:page.resources.fal>
</div>
<div class="col-sm-9">
<h3>{tour.title}</h3>
{tour.abstract}
</div>
</div>
</f:for>
</v:page.menu.directory>
{page_uid} being the parent page, nothing is displayed.
If I change some of the sub-pages' doktype back to "default" they are displayed in the rendered menu.
any idea as to why this is? Am i missing a certain argument in the viewhelper? i also tried to set the allowed doktypes in the viewhelper but that doesn't change anything.
thanks for the reponses, indeed it had to do with the doktype, is I didn't include the "new" ones for both the parent pages AND their sub-pages. Works now, solved. Fluid really rocks