We are setting up a news integration for one of our customers and he needs the content element feature. But when adding a new content element to the News the system always selects an inexisting colPos. Through this, you can't specify the type of the content element before the colPos got changed.
Is it possible to change the default colPos from 0 to 1 or so?
I have tried to set the colPos by following code in the PageTS but it hasn't worked out for me.
TCEFORM.tt_content.colPos.config.default = 1
TCAdefaults.tt_content.colPos = 1 will force default value for all tt_content entries in this page (page tree).
Best way would be to set default value for news content elements only. This can be done with override child TCA
In TYPO3 version 7.6
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['content_elements']['config']['foreign_record_defaults']['colPos'] = '1';
In TYPO3 version 8.6 and 9.5
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['content_elements']['config']['overrideChildTca']['columns']['colPos']['config']['default'] = '1';
This can be configured in a custom project extension under ../Configuration/TCA/Overrides/tx_news_domain_model_news.php
TCAdefaults.tt_content.colPos = 1
Works for me. Add it to the page's TSConfig.
Related
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]
In TYPO3 9 I managed to display the current username in a FLUID-template with the following Typoscript:
[loginUser=*]
temp.username = TEXT
temp.username {
insertData = 1
value = {TSFE:fe_user|user|username}
noTrimWrap = | ||
}
[global]
In TYPO3 10.4 this is not working anymore. Any idea how to display the current user?
Many thanks! Urs
In Typo3 V10, you have to use the Context API to retrieve data from global objects, try this :
[frontend.user.isLoggedIn]
temp.username = TEXT
temp.username.data = TSFE:fe_user|user|name
temp.username.wrap = |
[global]
Have a look at those links :
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/DataTypes/Index.html
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Context/Index.html#context-api
Florian
It's probably not working because you're using the old TypoScript conditions. Since TYPO3 9 the conditions work with Symfony expressions. The old conditions were deprecated in TYPO3 9 (but still worked) and removed in TYPO3 10. So [loginUser=*] will never be true in TYPO3 10. You should use [frontend.user.isLoggedIn] instead.
See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Conditions/Index.html for more about the new TypoScript conditions.
Why use TypoScript? It is very limited on what it can bring back. I just finished a tutorial where you can use a ViewHelper to add an ExtBase variable which assigns the whole user object in the FrontEnd and you can use it wherever you want with all it's relations, even the image, which is difficult to get via TypoScript.
TYPO3 tutorial
Best regards
I am currently updating a website from Typo3 7 to Typo3 9. The Website includes a Sitemap, which I would like to also show pages that are marked as "Not in Menus". On the old version, this could be achieved usnig the following bit of typoscript:
tt_content.menu.20.2.includeNotInMenu = 1
tt_content.menu.20.2.excludeDoktypes = 6
This, however does not work anymore in v9 and I can't find any help on Google.
TYPO3 9 uses fluid_styled_content to render content instead of css_styled_content. The sitemap is rendered using a MenuProcessor. These same options are available in the MenuProcessor. You can set them using the following TypoScript:
tt_content.menu_sitemap.dataProcessing.10 {
includeNotInMenu = 1
excludeDoktypes = 6
}
The above solutions did not work for me. I am using Typo3 9.5.19
The following worked:
Add to constants
plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.additionalWhere = no_index = 0 AND canonical_link = '' AND nav_hide = 0
Note: This does stop sub pages under a hidden page. all pages needs to be marked hidden
How is it possible to set in Page TSConfig the default value for "Number of Columns" in TYPO3 V7.6? In erlier versions it was possible with TCEFORM.tt_content.imagecols = 1. If I set in V7.6 TCEFORM.tt_content.imagecols = 1 it makes no different which value is set. There is always imagecols = 2 set.
I have PHP 7.0.7 and use the rendering extension fluid_styled_content (not css_styled_content). Is there something I am missing?
Thanks in advance for your help.
TCAdefaults.tt_content.imagecols = 1
works for me in TYPO3 7.6.11
TCEFORM.tt_content.imagecols.config.default = 1 is not working, as described op.
Be aware: This config never works if you switch content type after saving a content:
https://forge.typo3.org/issues/75233
I have a page running TYPO3 4.5.x that has a singleview of a plugin (plugin.tx_browser). I would like the default pivar showUid to be the uid of the currently logged in user.
I can get the uid in typoscript with
data = TSFE:fe_user|user|uid
And I know I can set the piVar to a fixed value with
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid = 575
but i can not set
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid.data = TSFE:fe_user|user|uid
Is there a way to set the pivar thorugh typoscript dynamically?
The suggestion to use the stdWrap property unfortunately does not seem to work prior to TYPO3 6.2
Thanks
It's possible since Version 6.2. You just need to add the stdWrap property:
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid.stdWrap.data = TSFE:fe_user|user|uid
See the the corresponding part in the TypoScript Reference.