define Frontend Layouts for page trees - layout

I'm using the field Frontend-Layout at my TYPO3 7.6-Backend. Because my website will have four different departments with different colours in frontend.
So I'm using:
TCEFORM {
pages {
layout {
altLabels {
0 = [ blue]
1 = [ orange ]
2 = [ green]
3 = [ yellow]
}
}
}
} ### TCEFORM
At my FLUIDTEMPLATE I'll wrap an <div>-wrapper, to set my different languages globally at my stylesheet. f.e. div.wrap.blue { background-color:blue;}
<div class="wrap
{f:if(condition:'{data.layout} == 0',then:'blue')}
{f:if(condition:'{data.layout} == 1',then:'orange')}
{f:if(condition:'{data.layout} == 2',then:'green')}
{f:if(condition:'{data.layout} == 3',then:'yellow')}">
...
This works perfect for me.
But how can I slide (or inherit) the frontend-layout-info from my parent-page to the subpages on my pagetree? I don't want to choose the frontend layout in page properties everytime, if I will add a new page into my pagetree. This must be working automatically. Is this possible? With slide?
For example
*ROOT
+ parent blue
~~ sub blue 1 /* these pages also have frontend layout 0 */
~~ sub blue 2
+ parent orange
~~ sub orange 1
+ parent green
...
+ parent yellow
...
Thebks for your opinion or tips ..

I don't think it's dead simple to set the {data.layout} layout recursively without manipulating the database. I have three 'solutions' coming to mind to solve your problem:
1) Create four Backend Layouts that you can select for your current and childpages. (Basically rinse and repeat what you have done for your first backend layout)
2) Using your layout modes you could try setting a body class using typoscript like so (i did not test this):
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = data.layout
page.bodyTagCObject.wrap = <body class="color-|">
3) Use a similar typoscript but update the value using typoscript conditions such as [pidInRootline]
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.wrap = <body class="blue">
[PIDinRootline = 1]
page.bodyTagCObject.wrap = <body class="orange">
[global]
[PIDinRootline = 2]
page.bodyTagCObject.wrap = <body class="green">
[global]
# and so on

I had your same problem and this typoscript worked fine for me,
the result is what you wanted to reach.
as you can see the 20.10 object is used when frontend layout is set on the page, while the 20.20 object is used when frontend layout is not set and takes it in slide mode:
page {
bodyTagCObject >
bodyTagCObject = COA
bodyTagCObject {
stdWrap.noTrimWrap = |<body |>|
20 = COA
20 {
wrap = class="|"
10 = TEXT
10 {
if.isTrue.data = page:layout
data = page:layout
noTrimWrap = |page-layout-| |
}
20 = TEXT
20 {
if.isFalse.data = page:layout
data = levelfield:-2, layout, slide
noTrimWrap = |page-layout-|
}
}
}
}
I hope I have been helpfull.

Related

Code not saving when trying to wrap promoted tiles in SharePoint Online

Apologies for another question re this, but I've tried so hard to get this working (I'm fairly new to SharePoint, don't have extensive coding knowledge, but know HTML and generally alright at trouble shooting).
We are using SharePoint online and we have SharePoint Tiles. We have recently added a few more tiles and it's obviously not wrapping these tiles, thus having to scroll right to access some.
I have found the code for wrapping the tiles here and when editing the page source, it appears to be working... until I save it. The code I put in is stripped out when I next go to the content editor.
I've read a few pages on it and have tried things such as the content editor web part, but for the life of me cannot get it to work.
If anyone would know if there's a step to step guide to ensure wrapped tiles are saved, I may be able to get it to work.
Any help is greatly appreciated.
If it changes anything, we use SharePoint online that is part of our Office 365 account.
Add the following code into script editor web part in the page.
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// Update this value to the number of links you want to show per row
var numberOfLinksPerRow = 6;
// local variables
var pre = "<tr><td><div class='ms-promlink-body' id='promlink_row_";
var post = "'></div></td></tr>";
var numberOfLinksInCurrentRow = numberOfLinksPerRow;
var currentRow = 1
// find the number of promoted links we're displaying
var numberOfPromotedLinks = $('.ms-promlink-body > .ms-tileview-tile-root').length;
// if we have more links then we want in a row, let's continue
if (numberOfPromotedLinks > numberOfLinksPerRow) {
// we don't need the header anymore, no cycling through links
$('.ms-promlink-root > .ms-promlink-header').empty();
// let's iterate through all the links after the maximum displayed link
for (i = numberOfLinksPerRow + 1; i <= numberOfPromotedLinks; i++) {
// if we're reached the maximum number of links to show per row, add a new row
// this happens the first time, with the values set initially
if (numberOfLinksInCurrentRow == numberOfLinksPerRow) {
// i just want the 2nd row to
currentRow++;
// create a new row of links
$('.ms-promlink-root > table > tbody:last').append(pre + currentRow + post);
// reset the number of links for the current row
numberOfLinksInCurrentRow = 0;
}
// move the Nth (numberOfLinksPerRow + 1) div to the current table row
$('#promlink_row_' + currentRow).append($('.ms-promlink-body > .ms-tileview-tile-root:eq(' + (numberOfLinksPerRow) + ')'));
// increment the number of links in the current row
numberOfLinksInCurrentRow++;
}
}
});
</script>
We can also use CSS style below in script editor web part in the page to achieve it.
<style>
.ms-promlink-body {
width: 960px;
}
</style>

Typo3: GIFBUILDER add distorted text on top of image

I want to open a blank catalog image and apply on top of it some skewed (distorted) text.
I have this typoscript snippet:
/**
* Catalog image
*/
lib.catalogImage = IMAGE
lib.catalogImage {
file = GIFBUILDER
file {
XY = 242,270
format = png
quality = 80
10 = IMAGE
10 {
file = EXT:theme/Resources/Public/Images/catalog_blank.jpg
}
15 = IMAGE
15 {
offset = 20,20
file = GIFBUILDER
file {
XY = 150,50
10 = TEXT
10 {
text = Datenblatt
fontSize = 12
offset = 28,110
fontColor = black
niceText = 1
}
20 = SCALE
20 {
params = -matte -virtual-pixel transparent -distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65'
}
}
}
}
}
The problem is, I always get the text box white, with no text in it.
What am I doing wrong?
Blank catalog image:
Result image:
EDIT:
I've also tried adding:
niceText.after = -matte -virtual-pixel transparent -distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65'
to the TEXT object, according to the docs (https://docs.typo3.org/typo3cms/TyposcriptReference/Gifbuilder/ObjectNames/Index.html), but it doesn't seem to be considered at all.
The result is this:
It looks like niceText doesn't get along with SCALE.
I removed niceText and the text is now displayed correctly.

Typo3 list the content of all child-pages as content of the parent page

As the title says, I need to list the content of all child-pages on the parent-page, after its own content. Or the thing I really need is, one page with content and and a menu which links to the different headers of the content. e.g. athe parent-page with content:
**Parent Head**
parent text
*first subhead*
first subtext
*second subhead*
second subtext
and the menu should look like:
Parent
-first subhead
-second subhead
I thought it would be easier if the parent-page "collects" the content of the child-pages.
The other solution was, that the child-pages would be links to extern URLs, to the specific c-IDs of the different contents of the parent-page. But I think this isn't that easy for the website owner, who doesn't know anything about where he can find the right c-ID in the web-page-source-code.
So how would You make that? Or how can I realize the thing with the child-page-content?
EDIT: Have a solution now. Just have to fix, that the submenu will be displayed without childpages.
Here is the code:
temp.contentnav = CONTENT
temp.contentnav {
table = tt_content
select {
pidInList = 7
orderBy = sorting
where = colPos=0
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
wrap= <li>|</li>
typolink.parameter.field=pid
typolink.parameter.dataWrap=|#{field:uid}
typolink.ATagParams = class="linkClass"
if.isTrue.field=header
}
wrap = <ul id="submenuClass"> | </ul>
}
page.10.marks.MENU.2.NO.after.cObject < temp.contentnav
Try something like this
temp.pageIds = HMENU
temp.pageIds.entryLevel = 1
temp.pageIds.1 = TMENU
temp.pageIds.1 {
NO.stdWrap.field = uid
NO.allWrap = |,
NO.doNotLinkIt = 1
}
lib.container = CONTENT
lib.container.table = tt_content
lib.container.select {
pidInList.cObject < temp.pageIds
}
There is a content element "Menu/Sitemap" with has an option to render subpages with content.
If you want to do it via TypoScript, render the menu, and then replace the menu items with content of them.
# Pseudocode on menuitem
# assuming you are using css_styled_content
1.allStdWrap.cObject < styles.content.get
# Set pid for CONTENT object from styles.content.get to the uid of the page
# which gets rendered
1.allStdWrap.cObject.select.pidInList.data = uid
Can't provide you with an working snippets atm.

rootline not working with TYPO3 4.5 menus

I'm having problems with TYPO3. I have been using it for quite a few years, since version 3.8 but this is my first site using version 4.5 and I am having problems with the menus and the rootline.
I believe it is related to how the rootline is created. using the code below for the breadcrumb/path type of menu only the current page is displayed. The menu only displays page X using example and code below when in page X and it should be
home > section 1 > sb a > page X
home
--- section 1
------- sub A
---------- page X
--- section 2
Also when displaying menus the ACT state isn't being properly activated. As I understand every page in the path/rootline should activate the ACT state and it is not happening with code below.
Has any thing changed in this version?
I have used both piece of codes in many sites up to now in version 4.5
codes
temp.breadcrumbs = HMENU
temp.breadcrumbs.special = rootline
#temp.breadcrumbs.includeNotInMenu = 1
#temp.breadcrumbs.special.range= -2 | -1
temp.breadcrumbs.special.range = 0
temp.breadcrumbs.1= TMENU
temp.breadcrumbs.1.noBlur = 1
temp.breadcrumbs.1.NO.allWrap= | > |*||*| |
## with and without line ... special.range ...
.....
....
temp.topmenu.1 {
wrap = <ul>|</ul>
# NO.allWrap = <li>|</li>
expAll = 1
NO.wrapItemAndSub = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.wrapItemAndSub = <li class="current-menu-item">|</li>
}
temp.topmenu.2 = TMENU
temp.topmenu.2.noBlur = 1
temp.topmenu.2 {
wrap = <ul class="sub-menu">|</ul>
NO.linkWrap = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.linkWrap = <li class="active">|</li>
#ACT.allWrap = <li class="selected">|</li>
#ACT.ATagBeforeWrap = 1
}
thanks
Ivan.
as cascaval wrote it's quite common to declare begin and end levels, anyway 0 value is aceptable too, as written in doc for entryLevel
Default is "0" which gives us a menu of the very first pages on the site.
Probably you put some TypoScript on the page X which has Rootlevel field checked, so it avoids traversing the tree up-side. I examined your sample code on first implementation I had available and it works as expected.
The range is supposed to be defined as [begin-level] | [end-level] so try:
temp.breadcrumbs.special.range = 0|-1
...or...
temp.breadcrumbs.special.range = 1|-1
-1 means current page.
-2 means the page one level up from the current page.
NOTE: You should probably set temp.breadcrumbs.includeNotInMenu = 1 because usually you would like to have all the pages in the breadcrumbs (as the structure that breadcrumbs represent wouldn't otherwise make sense), that is including those that you don't want to appear in other menus.
Had the same problem in Typo3 6.2.14 and finally found a solution.
After clearing "Template on Next Level" rootline worked perfectly.
Reason:
the root template was referenced in root templates "Template on Next
Level".
Solution:
edit root template
switch to tabfolder "Options"
clear field "Template on Next Level"

Change menu link title into image with typoscript

My typo3 websites has a menu with the follwing typoscript definition:
lib.footernav = HMENU
lib.footernav.special = directory
lib.footernav.special.value = 38
lib.footernav.entryLevel = 0
lib.footernav.1 = TMENU
lib.footernav.1.NO {
ATagParams = class = "footer-link"
}
The menue works just fine. What I want to do is, change the link text into an image, like this:
<a class="footer-link" href="index.php?id=43&L=1">Facebook</a>
to
<a class="footer-link" href="index.php?id=43&L=1"><img src="facebook.gif"/></a>
How can I do that?
If it helps I could also create a new menu for this facebook link.
I recommend to use the "Media" field of the menu's target pages to define, which pages in the menu should be displayed using an image. The Media field can be found in the "Resources" tab of the page properties. It is the perfect solution for your problem because it allows you to freely choose any image for any menu item:
For menu items that you want to appear as an image, use the Media field of the corresponding menu page and select an image to use. For all menu items that you want to appear as text, simply leave the Media field empty.
Here is the TS code to create that behavior:
1 = TMENU
1.NO {
ATagParams = class="footer-link"
# Replace menu item text with image if defined in page tab "Resources"-->"Media"
stdWrap.override.cObject = COA
stdWrap.override.cObject{
10 = IMAGE
10.file.import = uploads/media/
10.file.import.field = media
10.altText.field = title
}
}
UPDATE FOR TYPO3 6.2 WITH FAL:
TYPO3 6.2 includes FAL – a new media resource management system. As the resources tab of the page properties is now also based on FAL, you need a different TypoScript approach to access those image(s). Here is an up-to-date solution:
1 = TMENU
1 {
wrap = <ul>|</ul>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
stdWrap.override.cObject = FILES
stdWrap.override.cObject {
references {
table = pages
fieldName = media
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:uid
file.treatIdAsReference = 1
titleText.data = file:current:title // field:nav_title // field:title
altText.data = file:current:alternative // field:nav_title // field:title
}
# start with first image
begin = 0
# show only one image
maxItems = 1
}
}
}
The parameter begin defines which of multiple images should be used (e.g. if you need one image as a headline background for the page and another one as an icon in the menus).
If you increase the maxItems parameter, multiple images will be returned (if multiple images are defined in the resources tab).
If you want to append/prepend the image to the menu text instead of replacing it, you have to change stdWrap.override.cObject to after.cObject or before.cObject in the above code.
Another solution is to define a custom class for each link, then change the background image only for according links. This way you can fully control the menu's appearance by css:
lib.footernav.1.NO {
ATagParams = class="footer-link {field:title}"
ATagParams.insertData = 1
}
Results in following html:
<a class="footer-link Facebook" href="index.php?id=43&L=1">Facebook</a>
css:
.Facebook {
background: transparent url(facebook.gif) no-repeat;
text-indent:9999px;
}
EDIT: I recommend the above solution, because it's a quick and fairly clean setup to address a single menu item. However, if you like a clean example from the typoscript textbook:
lib.footernav = COA
lib.footernav.10 = HMENU
lib.footernav.10 {
special = directory
special.value = 38
excludeUidList = 99
1 = TMENU
1.NO {
ATagParams = class = "footer-link"
}
}
lib.footernav.20 = TEXT
lib.footernav.20 {
field = title
typolink.parameter = 99
typolink.ATagParams = class = "footer-link"
}
Assuming that your facebook menu item is page ID 99
Like so lib.footernav.1.NO.stdWrap.wrap = <img src="|.gif" />?
Make sure to add a wrap.htmlSpecialChars = 1 to avoid breaking the HTML code if an editor enters HTML special chars.
lib.footerSocialMedia = HMENU
lib.footerSocialMedia {
special = directory
special.value = 167
1 = TMENU
1 {
wrap = <ul class="social-list right">|</ul>
expAll = 1
noBlur = 1
NO {
wrapItemAndSub = <li class="skew-25">|</li>
doNotLinkIt = 0
stdWrap.htmlSpecialChars = 1
stdWrap.field =
ATagParams =data-title="{field:title}" data-tooltip="true"
ATagParams.insertData=1
stdWrap.wrap = <span class="{field:tx_menuicon_menuicon}"></span>|
stdWrap.wrap.insertData=1
}
ACT = 1
ACT {
wrapItemAndSub = <li class="skew-25">|</li>
doNotLinkIt = 0
stdWrap.field =
stdWrap.htmlSpecialChars = 1
ATagParams =data-title="{field:title}" data-tooltip="true"
ATagParams.insertData=1
stdWrap.wrap = <span class="{field:tx_menuicon_menuicon}"></span>|
stdWrap.wrap.insertData=1
}
}
}
First you need to add image in media of page under Page->edit and then add the image in media. Further, use the following typoscript:
stdWrap.override.cObject = COA
stdWrap.override.cObject{
10 = IMAGE
10.file.import = uploads/media/
10.file.import.field = media
10.altText.field = title
}

Resources