Hide specific elements on page (Typoscript) - typo3

Is there some way how to hide specific elements on specific page using Typoscript in TYPO3?
The URL is for example: www.mywebsite.com/subpage1
I want to hide menu and footer part only on this subpage1.
Thank you

If the menu and footer are created through TypoScript you can use conditions in TypoScript to overwrite them. For example:
lib.footer = TEXT
lib.footer.value = This is my footer
[globalVar = TSFE:id = 4]
lib.footer >
[global]
In this example the uid of the page where I want to not show the footer is 4.
More on conditions in TypoScript can be found here: https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html

A clean way would be to define different page-layouts and assign them to the pages where these elements are not desired. With fluid partials you could recycle most parts of the page and depending on the layout render footer and menu.
As you get a nice inheritance mostly the fields backend_layout and backend_layout_next_level are used. You will find a lot of examples.
fluid handling could be found in typoscript backend_layout_next_level not working.
For templa voila (=TV) you can use a similar attempt: select different TV-templates depending on these fields.
Duplicate the given template, remove footer and menu and insert the new template to the set of given templates.

Related

typo3 add content element to all pages that are direct child of a certain page using typoscript

I have defined a menu content element using typoscript:
lib.share = COA
lib.share {
wrap = <div class="shareLinkBlock">|</div>
1 = TEXT
1.data = page : title
...
I would like to add this menu to colPos 2 of every page, that is direct child of a certain page.
Is there any way to achieve that?
Thanks a lot!
A solution depends on the current realization of the page.
If you use only typoscript you can replace the colPos2 rendering with a COA where your typoscript is part one and the old rendering is a second part.
Using conditions can restrict the appearance to selected page trees.
In similar ways you can realize it with FLUID.
You can insert a fluid variable, filled with your typoscript in every page.
The restriction to special page trees can be realized with conditions in typoscript or in FLUID. Also you can use different page-layouts for pages with and without this menu.
another solution would be an additional backend column which gets inherited and where you fill in your menu for those pages where the menu starts being visible. (conditions like above)
EDIT:
if you want to enhance a given FLUID variable, defined in typoscript you can word with a COA:
:
10 = FLUIDTEMPLATE
10 {
:
variables {
enhancedColumn = COA
enhancedColumn {
10 = ..old definition ...
}
}
}
:
// make sure you use the correct conditions:
[PIDinRootline = 10]
...10.variables.20 < lib.footer
[global]

Condition for backend layout name in Typo3 10+

I'm looking for a way to render a partial for when an element is placed it on a part of the backend layout and another partial for when the same element is placed it on another part of the backend layout.
My backend layout names are "Header" on top and "Normal" on the bottom. I want to render text-media element with one partial for when is on Header and another partial for when is on Normal.
For what I could find online seems that this must be done with typoscript. Particualrly I want to use typoscript condition because is the one that make more sense on my head.
I'm aware of this but the answers are not helping me at all.
This is the one that looks like something I could use.
[page["backend_layout"] == 'pagets__2']
page.bodyTagCObject.value.wrap = <body id="uid|" class="fullpage">
[end]
Any help is welcome even tutorials because clearly I have much to learn about typoscripting
You can pass the needed value as a variable to your FLUIDTEMPLATE-object.
The current backend-layout is available as pagelayout (Already with the 'backend_layout_next_level' taken into account).
page.10 = FLUIDTEMPLATE
page.10 {
variables {
pagelayout = TEXT
pagelayout.data = pagelayout
}
}
Solved it.
I have been able to solve this problem without useing Typoscript. (so I will keep ignoring typoscript :D )
Dropping the variables of the loaded templates (not partials) made me realized that there was a property holding the colPos of the backend layout so all I had to do was an if condition on the textmedia default template.
<f:if condition="{data.colPos} == 1">
If the colPos of the backend layout is 1 print something
</f:if>

TYPO3: Site Configuration Data inside TSconfig Condition

The divider content element is disabled for all pages via TCEFORM.tt_content.CType.removeItems := addToList([…], div) in PageTSconfig. This works just fine.
Now I want that the divider is only available for a certain subset of pages.
I defined the uppermost page in my site configuration which leads to the following Typoscript:
[site("configuration")["settings"]["pages"]["simpleLanguage"] and site("configuration")["settings"]["pages"]["simpleLanguage"] in tree.rootLineIds]
TCEFORM.tt_content.CType.removeItems := removeFromList(div)
[END]
Now when I want to insert an divider on that given pages, I can choose it from the NewContentElement Wizard, but when the form of the content element gets rendered the divider is missing in the CType select.
Divider is shown in NewContentElement Wizard
But not in the content element form.
I found out that when setting the pageuid directly, the condition is evaluated fine.
So my conclusion ist that I cannot get site information inside TSconfig.
So how can I get the information from the site config inside TSconfig?
Conditions in PageTS have been fixed for TYPO3 v10 with https://forge.typo3.org/issues/89718.
The patch has not been backported to v9 due to its complexity.
The new content element wizard uses another configuration:
https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/Mod.html#newcontentelement-wizarditems
# PageTS
# CType "div" is in group "special"
mod.wizards.newContentElement.wizardItems.special.show := removeFromList(div)

TYPO3 hide content element options in wizard

I want to show only the column options from the grid elements tab to the editors group when they create a new content element. So I tried to edit the groups TSconfig.
tx_gridelements.setup.tabs4 >
tx_gridelements.setup.tabs6 >
This has no effect. How do I remove all but the column options?
Update: With your help I figured out that my problem is not about the text in the TSconfig but that it is not loaded from the backend user group nor the beuser.
The elements you want to disable are located in Page TSconfig under mod.wizards.newContentElement.wizardItems. You can see them in the "Info" module under "Page TSconfig" :
You can simply disable them by adding
# example for the given screenshot
mod.wizards.newContentElement.wizardItems.common.elements.header >
I don't think that the answer from #statix will work with grid elements.
But in the settings of your backend layout, you can define what type of content elements are allowed within a specific content area:
And within the settings of each grid element you can define again, which content elements are available, e.g. to prevent nesting of grid elements.
Put this code in root page tscPage TSConfig
tx_gridelements.excludeLayoutIds=your grid id
May It helps you!!

How to hide the output comming from an inherited content element?

On a sub page I am inheriting multiple content elements from a parent page. Now I need to hide one of them, while keeping the rest untouched.
Any ideas?
One idea would be to use TypoScript to hide the output from the respective content element or plugin.
Identify the responsible element for the output using TYPO3 ADMIN PANEL.
Create a new template for the page (List view) and add the necessary configuration in the Setup field.
Below is an example:
[globalVar = TSFE:id = YOURPAGEID]
plugin.tx_exampleplugin >
[global]