TYPO3 v6.1 TemplaVoila - add userFunc to specific template part - typo3

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.

Related

TYPO3 FLUID blank page TYPO3

I try to create my first FLUIDTEMPLATE. But the Methode
f:layout
dont get activated.
My structure:
/fileadmin/
/fileadmin/layouts/layout.html
/fileadmin/partials/
/fileadmin/styles/
/fileadmin/templates/template.html
/fileadmin/typoscript/
/fileadmin/typoscript/01_script/setup.ts
/fileadmin/typoscript/02_object/
setup.ts:
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = fileadmin/templates/layouts/layout.html
partialRootPath = fileadmin/templates/partials/
layoutRootPath = fileadmin/templates/layouts/
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
page.10.file.stdWrap.cObject = CASE
page.10.file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = fileadmin/templates/template.html
}
Layout.html:
<div id="wrapper">
<div id="header">
header
</div>
<div id="top_nav">
top_nav
</div>
<div id="left">
left
</div>
<div id="right">
right
</div>
<div id="center">
center
</div>
<div id="footer">
footer
</div>
</div>
template.html:
<f:layout name = "Layout" />
template setup:
<INCLUDE_TYPOSCRIPT: source ="DIR:fileadmin/typoscript/">
Now, if i view the webpage i only see a blank page. If i look on the code i get that:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
This website is powered by TYPO3 - inspiring people to share!
TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
TYPO3 is copyright 1998-2017 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Information and contribution at https://typo3.org/
-->
<title>Fluid</title>
<meta name="generator" content="TYPO3 CMS">
<link rel="stylesheet" type="text/css" href="typo3temp/Assets/b9db200ac9.css?1491821607" media="all">
</head>
<body>
<f:layout name = "Layout" />
</body>
</html>
I am using TYPO3 v7.6.16.
Templates: Startseite.html
<f:layout name="Default" />
<f:section name="body">
<div id="wrapper">
<div id="header">
{header->f:format.raw()}
</div>
<div id="top_nav">
{top_nav->f:format.raw()}
</div>
<div id="left">
{left->f:format.raw()}
</div>
<div id="right">
{right->f:format.raw()}
</div>
<div id="center">
{center->f:format.raw()}
</div>
<div id="footer">
{footer->f:format.raw()}
</div>
</div>
</f:section>
you can configure same for inner page(Inhaltsseite) layout.
Layouts: Default.html
<f:render section="body" />
Typoscript: (setup.ts)
lib.pageTemplate = FLUIDTEMPLATE
lib.pageTemplate {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.field = backend_layout
# #todo: setup all page templates
default = TEXT
default.value = Startseite
1 = TEXT
1.value = Inhaltsseite
}
templateRootPaths {
10 = fileadmin/templates/Resources/Private/Templates/
}
partialRootPaths {
10 = fileadmin/templates/Resources/Private/Partials/
}
layoutRootPaths {
10 = fileadmin/templates/Resources/Private/Layouts/
}
variables {
content = CONTENT
content {
table = tt_content
select.orderBy = sorting
slide = -1
select.where = colPos=0
}
}
}
# Page setup Configuration
page = PAGE
page {
# Your TypeNum
typeNum = 0
#Include header data if any
headerData{
}
#Include website meta
meta{
}
#Include stylesheet
includeCSS {
}
#Include Js files(In the header)
includeJS {
}
#Include Js in footer
includeJSFooter {
}
# assign template (copy fluid template object)
10 < lib.pageTemplate
}
Include setup.ts in the template->include->setup.ts from the BE.
<INCLUDE_TYPOSCRIPT:source="FILE:fileadmin/templates/Configuration/TypoScript/setup.ts" />
Greetings!
There are several issues with your example code. Lets go through them:
You should not put your templates in the fileadmin where they are (by default) accessable by web requests and editable by editors. Instead put them inside an extension under Resources/Private/.
You should not specify the layout file as your template. You have
file = fileadmin/templates/layouts/layout.html
Instead of the layout.html you should point to a template like your Template.html inside Resources/Private/Templates
In your template you then may include a layout file. But remove the whitespaces: <f:layout name="Layout" />.
Use UpperCase names for your template, layout and partial files (Template.html instead of template.html).
Use templateRootPaths and layourRootPaths and partialRootpaths instead.
So your TypoScript could look like this:
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = EXT:my_ext/Resources/Private/Templates/Template.html
partialRootPaths {
10 = EXT:my_ext/Resources/Private/Partials/
}
layoutRootPaths {
10 = EXT:my_ext/Resources/Private/Layouts/
}
templateRootPaths
10 = EXT:my_ext/Resources/Private/Templates/
}
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
you first have to create a page object in typoscript (which is missing in the typoscript above):
page = PAGE
this should be the first line in your typoscript.

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.

How to define fluid template for grid elements?

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
}

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

Get current pagetitle in Typo3 in Hmenu

I want to get the pagetitle of the current page I'm on in Typo3. I want to wrap a div - Box for a Hmenu. That works, but I also want the Title in the div to be the title of the current page. My typoscript looks like this
temp.pagetitle = TEXT
temp.pagetitle.field=title
page=PAGE
page.typeNum = 0
page.10.marks.LEFT_MENU = HMENU
page.10.marks.LEFT_MENU {
special = directory
special.value = {$pwcms.linkesMenu.rootSeitenID}
excludeUidList = {$pwcms.linkesMenu.nichtSichtbareSeiten}
stdWrap.preCObject < temp.pagetitle
stdWrap.wrap = <div class="bigBox shadow"> <div class="csc-header csc-header-n1">
<h1 class="csc-firstHeader">temp.pagetitle</h1></div>| </div>
stdWrap.wrap.insertData = 1
If I save these settings and reload the page, the caption in my div Box just says "temp.pagetitle"
I guess it should be some kind of this way:
page = PAGE
page.typeNum = 0
page.10.marks.LEFT_MENU = HMENU
page.10.marks.LEFT_MENU {
special = directory
special.value = {$pwcms.linkesMenu.rootSeitenID}
excludeUidList = {$pwcms.linkesMenu.nichtSichtbareSeiten}
stdWrap.preCObject = TEXT
stdWrap.preCObject.data = page : file
stdWrap.preCObject.wrap = <div class="bigBox shadow"> <div class="csc-header csc-header-n1">
<h1 class="csc-firstHeader"> | </h1> </div> </div>
}