At the moment I am using this TS to prepare my content from a grid element (https://typo3.org/extensions/repository/view/gridelements):
tt_content.gridelements_pi1.20.10.setup {
1 < lib.gridelements.defaultGridSetup
1 {
columns {
10 < .default
10.wrap = <div class="gefa">|</div>
11 < .default
11.wrap = <div class="gefa2">|</div>
12 < .default
12.wrap = <div class="gefa3">|</div>
13 < .default
13.wrap = <div class="gefa4">|</div>
}
}
}
Now I want to make a html template (fluid) with placeholders for my content from the grid element. How to do this?
You can define the rendering like a cObject.
tt_content.gridelements_pi1.20.10.setup {
1 < lib.gridelements.defaultGridSetup
1 {
cObject = FLUIDTEMPLATE
cObject {
file = path/to/your/fluid/template.html
}
}
}
in your fluid tempalte you can use the columns like this:
<div class="gefa">
<f:format.raw>
{data.tx_gridelements_view_column_10}
</f:format.raw>
</div>
<div class="gefa2">
<f:format.raw>
{data.tx_gridelements_view_column_11}
</f:format.raw>
</div>
What TYPO3 Version do you use? On version 8.7.x I simply use these lines:
lib.gridelements.defaultGridSetup.cObject =< lib.contentElement
tt_content.gridelements_pi1.20.10.setup.{
mycontent < lib.gridelements.defaultGridSetup
mycontent.cObject.templateName = MyTemplate
}
Related
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
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.
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.
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
how can I replace programmatically via TypoScript the content of {content_left} in a single page via USER_INT with individual PHP content.
<div class="container">
<div class="header span-28">
<f:format.raw>{header}</f:format.raw>
</div>
<img class="logo" src="../fileadmin/logo.png" alt="logo">
<img class="headerimg" src="../fileadmin/header_img.png" alt="headerimg">
<div class="menu span-28">
<f:format.raw>{main_menu}</f:format.raw>
</div>
<div class="service span-28">
<f:format.raw>{service_menu}</f:format.raw>
</div>
<div class="content span-6 append-1">
<f:format.raw>{content_left}</f:format.raw>
</div>
<div class="content span-22 last">
<f:format.raw>{content_right}</f:format.raw>
</div>
<div class="footer span-28 last">
<f:format.raw>{footer}</f:format.raw>
</div>
</div>
My current TypoScript does look like this:
#
temp.info = USER_INT
temp.info {
userFunc = user_various->listContentRecordsOnPage
reverseOrder = 1
debugOutput = 1
}
page.content_left < temp.info
But it does not work. :( No replacement is done.
Thanks for any help.
Cheers
kk3003
gsnerf is absolutety right, it's a FLUIDTEMPLATE element.
Unfortunately this TYPOSCRIPT set to the single page where it should appear does not work, any ideas please?
# Include the PHP file with custom code
includeLibs.user_various = fileadmin/php/example_listRecords.php
#
temp.info = USER_INT
temp.info {
userFunc = user_various->listContentRecordsOnPage
}
page = PAGE
page {
typeNum = 0
metaCharset = utf-8
includeCSS{
file10 = fileadmin/css/blueprint/screen.css
file20 = fileadmin/css/blueprint/print.css
file20.media = print
file100 = fileadmin/css/main.css
file300 = fileadmin/css/service.css
file400 = fileadmin/css/mainMenu.css
file500 = fileadmin/css/sliding-box.css
file600 = fileadmin/css/gridelements.css
}
includeJS {
file10 = fileadmin/js/accordion.js
}
}
[browser = msie]
page.includeCSS.file30 = fileadmin/css/blueprint/ie.css
page.includeCSS.file30.media = screen
[global]
page.meta {
MSSmartTagsPreventParsing = true
imagetoolbar = false
}
# https_enforcer
page.5 < plugin.tx_httpsenforcer_pi1
# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
# Set the Template Pathes
file = fileadmin/templates/html/template.html
partialRootPath = fileadmin/templates/html/partials/
layoutRootPath = fileadmin/templates/html/layouts/
variables {
header < lib.header
content_left < lib.contentLeft
content_right < temp.info
main_menu < lib.mainMenu
service_menu < lib.serviceMenu
footer < lib.footer
}
}
Thanks
I'm not sure what this is supposed to have to do with templavoila? This seems more like fluid to me. If that is the case you have to replace your
page.content_left < temp.info
with the following:
10 = FLUIDTEMPLATE
10 {
[...]
variables.content_left < temp.info
}
Assuming you already have a FLUIDTEMPLATE definition you only need to copy the variables line into that one.