How to get my other TYPO3 FE templates? - typo3

Although it seems so simple I only get one template in my FE. While the BE-layouts are working fine, I do not get any of my other FE-templates. Only the DefaultTemplate is popping up every time. After trying all kind of samples/ topics read, etc, I’m stuck on this. Here is my set-up.
The TSconfig and PageTS all other files are stored in the extension.
# Layout Select box for the FE templates
TCEFORM.pages {
layout.altLabels.3 = NewsLetterTemplate
layout.altLabels.2 = RedFooterTemplate
layout.altLabels.1 = DefaultTemplate
layout.altLabels.0 = DefaultTemplate
removeItems = 4,5,6,7,9,10
}
###########################################
# Config Fluid Template
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10{
#Path to the template files stored extension
partialRootPath = {$resDir}/Private/Partials
layoutRootPath = {$resDir}/Private/Layouts
file = {$resDir}/Private/Templates/DefaultTemplate.html
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = pagelayout
default = TEXT
default.value = {$resDir}/Private/Templates/DefaultTemplate.html
#Default template
pagets__DefaultTemplate = TEXT
pagets__DefaultTemplate.value = {$resDir}/Private/Templates/DefaultTemplate.html
#Second template
pagets__RedFooterTemplate = TEXT
pagets__RedFooterTemplate.value = {$resDir}/Private/Templates/RedFooterTemplate.html
#Third template
pagets__NewsLetterTemplate = TEXT
pagets__NewsLetterTemplate.value = {$resDir}/Private/Templates/NewsLetterTemplate.html
}
#Here some variables for use in the template by using {}
variables {
siteName = TEXT
siteName.value = PIZZAWORKSHOP.nl
pageTitle = TEXT
pageTitle.data = page:title
#get the content into the template:
content < styles.content.get
#Maincontent
content_main < styles.content.get
content_main.select.where = colPos = 0
#Content Colom 1
content_column_1 < styles.content.get
content_column_1.select.where = colPos = 1
#Content Colom 2
content_column_2 < styles.content.get
content_column_2.select.where = colPos = 2
}
}
https://pastebin.com/9TLytchv
Maybe one of you can point me into the right direction here? Thanks.
W.

You can add this typoscript Page TSConfig on resource tabe in page properties. For this typoscript you can rename defult frontend layout name.
TCEFORM.pages {
layout.altLabels.3 = NewsLetterTemplate
layout.altLabels.2 = RedFooterTemplate
layout.altLabels.1 = DefaultTemplate
layout.altLabels.0 = DefaultTemplate
}
For use different frontend layout like this.
[globalVar=TSFE:page|layout=3]
page.10.template.file = fileadmin/template/shinynewtemplate.html
page.includeCSS.screen = fileadmin/template/css/style.css
page.includeCSS.screen.media = screen
[global]

Related

Different Frontend-Layouts in TYPO3

I'm trying to use different Frontend-Layouts in TYPO3. So I'm using this fancy TypoScript:
page {
bodyTag = <body>
10= CASE
10.key.field=layout
# Standardtemplate
10.0 = TEMPLATE
10.0.template = FILE
10.0.template.file = fileadmin/template/content_template.html
10.0.workOnSubpart = DOCUMENT_BODY
# Variante 1:
10.1 = TEMPLATE
10.1.template = FILE
10.1.template.file = fileadmin/template/index_template.html
10.1.workOnSubpart = DOCUMENT_BODY
includeJSFooter {
jquery = fileadmin/template/js/jquery.js
bootstrap = fileadmin/template/js/bootstrap.min.js
app = fileadmin/template/js/app.js
}
includeCSS {
robotoFont = https://fonts.googleapis.com/css?family=Roboto:100,400
robotoFont.external = 1
robotoFont.media = all
bootstrapCore = fileadmin/template/css/bootstrap.min.css
bootstrapCore.media = all
}
}
This is not working yet. Every single page is completely. Only a white page appears. I'm using TYPO3 7.6.16. Is there any issue in my code above?
It think you are looking for this just place it in the PAGE-Element and rename the Path and also create some BackendLayouts named as value in layout 1. 2. 3. e.g. hope this will help:
10 = FLUIDTEMPLATE
10 {
file = fileadmin/templates/Page/Standard.html
partialRootPath = fileadmin/templates/Partials/
variables {
layout = CASE
layout {
key.field = backend_layout
key.ifEmpty.data = levelfield:-2, backend_layout_next_level, slide
1 = TEXT
1.value = startpage
2 = TEXT
2.value = subpage
3 = TEXT
3.value = subpagespecial
default = TEXT
default.value = subpage
}
content = CONTENT
content {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
select.languageField = sys_language_uid
select.includeRecordsWithoutDefaultTranslation = 1
}
header = CONTENT
header {
table = tt_content
select.orderBy = sorting
select.where = colPos=1
select.languageField = sys_language_uid
select.includeRecordsWithoutDefaultTranslation = 1
}
content2 = CONTENT
content2 {
table = tt_content
select.orderBy = sorting
select.where = colPos=3
select.languageField = sys_language_uid
select.includeRecordsWithoutDefaultTranslation = 1
}
contentfull = CONTENT
contentfull {
table = tt_content
select.orderBy = sorting
select.where = colPos=2
select.languageField = sys_language_uid
select.includeRecordsWithoutDefaultTranslation = 1
}
}
}
Please add a default variant in the CASE object. It may be that pages which are created anew do not have a '0' in its 'layout' column.
Did you verify that the subpart markers are spelled correctly?
<!-- ###DOCUMENT_BODY### begin -->
Your HTML template
<!-- ###DOCUMENT_BODY### end -->
You could simplify your TypoScript template:
page {
10 = TEMPLATE
10.template = FILE
10.template.file = CASE
10.template.file {
key.field = layout
default = TEXT
default.value = fileadmin/template/content_template.html
1 = TEXT
value = fileadmin/template/index_template.html
}
10.workOnSubpart = DOCUMENT_BODY
}

Typoscript: Overwrite Typoscript of an extension

I try to overwrite the typoscript of the extension tx_seobasics. In the tx_seobasics setup.txt I have:
plugin.tx_seobasics {
# Building the page title
10 = TEXT
10.data = page:tx_seo_titletag // page:title
10.trim = 1
10.stdWrap.stdWrap.append = TEXT
10.stdWrap.stdWrap.append.data = TSFE:tmpl|sitetitle
10.stdWrap.stdWrap.append.trim = 1
10.stdWrap.stdWrap.append.required = 1
10.stdWrap.stdWrap.append.if.isTrue = {$plugin.tx_seo.titleWrapAppendSiteTitle}
10.stdWrap.stdWrap.append.noTrimWrap = | - ||
10.stdWrap.noTrimWrap = {$plugin.tx_seo.titleWrap}
10.stdWrap.insertData = 1
10.htmlSpecialChars = 1
10.wrap = <title>|</title>
10.append < .5
20 < .10
20.wrap = <meta name="title" content="|" />
}
Now the idea is that I can set the value for 10.stdWrap.stdWrap.append.data individual for each language.
So my first step/test was I add following typoscript in the setup.txt of my own template:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.data = page:title
This works and instead of the sitetitle that is defined in the template I get the pagetitle as sitetitle.
Now I have 2 problems:
SOLVED First problem: Overwrite .data with .value
Instead of a field I want to add a value directly in typoscript, my idea was:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text
or
plugin.tx_seobasics.10.stdWrap.stdWrap.append = TEXT
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text
both options dont overwrite anything and it still takes the .data = TSFE:tmpl|sitetitle.
So how to overwrite .datawith .value?
Second problem: Set the value for each language separately.
My typoscript setup.txt looks like this:
[globalVar = GP:L = 1]
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_template/Configuration/TypoScript/setup-ch.txt">
[global]
[globalVar = GP:L = 2]
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_template/Configuration/TypoScript/setup-en.txt">
[global]
Edit: I had a mistake in my language files: I was closing 2 brackets } } on the same line. Never thought about it, but typoscript seems to not like that.
I currently have no idea for the language-condition problem but for overwriting the .data you should try to empty the data first:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.data >
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text

TYPO3 fluid variables

I upgrade my TYPO3 from 7.6 to 8.6.
Now I cant set variables via style.content.get, my root template loads fluid_styled_content.
some source:
page.10 = FLUIDTEMPLATE
page.10 {
partialRootPath ={$resDir}/Private/Partials
layoutRootPath = {$resDir}/Private/Layouts
variables {
contentMain < styles.content.get
contentMain.select.where = colPos = 0
contentnew < styles.content.get
contentnew.select.where = colPos = 1
contentkat < styles.content.get
contentkat.select.where = colPos = 2
test = TEXT
test.value = loool
}
}
display the variables:
<f:format.raw> {contentMain} </f:format.raw>
<f:format.raw> {contentnew} </f:format.raw>
<f:format.raw> {contentkat} </f:format.raw>
<f:format.raw> {test} </f:format.raw>
styles.content.get is defined in ext:fluid_styled_content but very late so most copies are empty. References are no solution as the modification for colPos would apply to all references.
At the moment the best solution seems to be an own definition of styles.content.get early in your TS:
styles.content.get = CONTENT
styles.content.get {
table = tt_content
select {
orderBy = sorting
where = colPos=0
}
}
but as it is an own definition I would rename it to temp.content.get so it is identifiable as my own version (no confusion if the global definition changes)
There is a Bug in TYPO3 8.6: https://forge.typo3.org/issues/80044
Add this before you assign styles.content.get to your variables:
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:frontend/ext_typoscript_setup.txt">
Then you can use it just as before.
SOLVED
Thanks to Bernd! Solved this problem.
Here a full example:
mystyles.content.get = CONTENT
mystyles.content.get {
table = tt_content
select {
orderBy = sorting
where = colPos=0
}
}
page.10 = FLUIDTEMPLATE
page.10 {
partialRootPath ={$resDir}/Private/Partials
layoutRootPath = {$resDir}/Private/Layouts
variables {
contentMain < mystyles.content.get
contentMain.select.where = colPos = 0
contentnew < mystyles.content.get
contentnew.select.where = colPos = 1
contentkat < mystyles.content.get
contentkat.select.where = colPos = 2
test = TEXT
test.value = loool
}
}

Fluid Template doesn't load

I'm building a site with Fluid Template. I have created two different front-end layouts and two different back-end layout but I always get this error #1288085266: No template has been specified. Use either setTemplateSource() or setTemplatePathAndFilename(). Accordingly to Typo3 Wiki this should be a solution Exception/CMS/1288085266
but not in my case. This is my code:
config.doctype = html5
page = PAGE
page {
includeCSSLibs.bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css
includeCSS.style = fileadmin/templates/rka2015/css/style.css
includeJSlibs.jquery = https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
includeJSlibs.bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js
includeJS.custom = fileadmin/templates/rka2015/js/custom.js
}
page.10 = FLUIDTEMPLATE
page.10 {
file = fileadmin/templates/rka2015/layouts/main_layout.html
layoutRootPath = fileadmin/templates/rka2015/layouts/
patialRootPath = fileadmin/templates/rka2015/partials/
variables {
siteName = TEXT
siteName.value = rka2015
contentMain < styles.content.get
contentMain.select.where = colPos = 0
content_column_1 < styles.content.get
content_column_1.select.where = colPos = 1
content_column_2 < styles.content.get
content_column_2.select.where = colPos = 2
}
}
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/rka2015/main_1_column.html
1 = TEXT
1.value = fileadmin/templates/rka2015/main_1_column.html
2 = TEXT
2.value = fileadmin/templates/rka2015/main_2_column.html
}
I have already checked all; section name is OK, ID for back-end layouts are ok, template is defined, everything seem to be as it should be. I really don't have a clue where else to search.
UPDATE!!!
Seems like there is a problem with a file path. I am running my site on a subdomain and it looks like that ts doesn't find the file paths if they are defined only as fileadmin/... Any thoughts? Thanks
SOLUTION!
page {
includeCSSLibs.bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css
includeCSS.style = fileadmin/templates/rka2015/css/style.css
includeJSlibs.jquery = https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
includeJSlibs.jquery.external = 1
includeJSlibs.bootstrap = https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js
includeJS.custom = fileadmin/templates/rka2015/js/custom.js
}
page.10 = FLUIDTEMPLATE
page.10 {
template = CASE
template {
key.data = levelfield:-1,backend_layout_next_level,slide
key.override.field = backend_layout
1 = FILE
1.file = fileadmin/templates/rka2015/main_1_column.html
2 = FILE
2.file = fileadmin/templates/rka2015/main_2_column.html
}
partialRootPath = fileadmin/templates/rka2015/partials/
layoutRootPath = fileadmin/templates/rka2015/layouts/
variables {
siteName = TEXT
siteName.value = rka2015
contentMain < styles.content.get
contentMain.select.where = colPos = 0
content_column_1 < styles.content.get
content_column_1.select.where = colPos = 1
content_column_2 < styles.content.get
content_column_2.select.where = colPos = 2
}
}
First, check out if TYPO3 can read the file by overwriting the page object by appending this to the end of your template:
page.10 >
page.10 = FILE
page.10.file = fileadmin/templates/rka2015/layouts/main_layout.html
If that doesn't generate a page with the raw, uninterpreted output of your template file, then theres something wrong with either the file path or file permissions.
Secondly, in Fluid, Templates and Layouts are different things with different uses and should propably not be put into the same directory.
Most importantly, theres something wrong with the backend layout switch you're trying to build with the CASE in page.10.file.stdWrap.cObject . You see, the stdWrap object actually wraps around the text you've already set. If stdWrap cant find a pipe to figure out how to wrap, it just appends instead. Remove the line where you set the file in the top part and only leave the stdWrap case and you should be good to go.
at the first look it looks right... but check your file paths, maybe they are wrong as "Jost" commented.
i'm not sure but i think the problem is that the template path (file = ...) is the same as layout root path...
by the way... if you include external styles and javascripts you need to set something like the follows i think...
includeJSlibs.jquery = https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
includeJSlibs.jquery.external = 1

typo3 css_styled content edit source

I have the following problem:
I am using typo3 4.7.7 and I am adding custom columns in the Backend. I am able to do taht by place a configuration array in the /typo3conf/extTables.php
$TCA["tt_content"]["columns"]["colPos"]["config"]["items"] = array (
"3" => array ("Border,"3"),
"2" => array ("Right","2"),
"1" => array ("Left","1"),
"0" => array ("Normal","0"),
"5" => array ("Central","5"),
"6" => array ("Border","6"),
"4" => array ("Footer","4")
);
Then set:
mod.SHARED.colPos_list=0,1,2,3,4,5,6
in the TSconfig.
It is working, I enjoy my new columns :), but there is a problem. I want to be able to use the css_styled_content to map my new columns to my html template. This is not possible, because the "get" constants of css_styled_content are hard coded and I am not able to use something like "content.getFooter". At the moment the only way I can get my content is like this:
...
page.10 = CONTENT
page.10.table = tt_content
page.10.select {
orderBy = sorting
where = colPos = 4
}
page.10.renderObj = COA
page.10.renderObj {
10 = TEXT
10.field = header
20 = TEXT
20.field = bodytext
}
...
This is a lot of code, so I was wondering if there is a way to "make" CSC recognize my new columns, so that I would be able to use "content.getMYCUSTOM_COLUMN_NAME".
P.S. I do not want to use templavoila and I found something in the source of CSC under /static/setup.txt :
# Clear out any constants in this reserved room!
styles.content >
# get content
styles.content.get = CONTENT
styles.content.get {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
select.languageField = sys_language_uid
}
# get content, left
styles.content.getLeft < styles.content.get
styles.content.getLeft.select.where = colPos=1
# get content, right
styles.content.getRight < styles.content.get
styles.content.getRight.select.where = colPos=2
# get content, margin
styles.content.getBorder < styles.content.get
styles.content.getBorder.select.where = colPos=3
# get news
styles.content.getNews < styles.content.get
styles.content.getNews.select.pidInList = {$styles.content.getNews.newsPid}
# Edit page object:
styles.content.editPanelPage = COA
styles.content.editPanelPage {
10 = EDITPANEL
10 {
allow = toolbar,move,hide
label.data = LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.page
label.wrap = | <b>%s</b>
}
}
I then tried to add:
# get content, footer
styles.content.getFooter < styles.content.get
styles.content.getFooter.select.where = colPos=4
But it did not work.
you are on the right track. try to create your own Content Object:
temp.footer < styles.content.get
temp.footer.select.where = colPos=4
page = PAGE
page.100 < temp.footer