How force a template file in tt_news LIST? - typo3

I have a list in tt_news and use many folders with tt_news records. I want to use a different template in this list when I filter and display specific category.
My Typoscript is:
[globalVar = GP:tx_ttnews|place|0 = 79]
#Display list of specific category
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/different.html
[else]
#General display list
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/general.html
[end]
I have used plugin.tt_news.templateFile and plugin.tt_news.file.templateFile but don't work. I am using the last version of tt_news and TYPO3 6.2

"plugin.tt_news.templateFile" is right, i think there is a problem in "[globalVar = GP:tx_ttnews|place|0 = 79]" you should close global with "[global]" instead of "[end]". Try this if it is helpful to you.

For the Typoscript way did not resolve this, I do not why? For we needed we have use a category and marker in the template of tt_news and create a logic in frontend through JS for resolve this.

Related

How to show username in frontend in TYPO3 10?

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

Reading data out of a flexform in typoscript

I try to read a flexform data out in typoscript. I tried it with several approaches, but none of them works correctly:
ajax.30 = TEXT
ajax.30.value = {$plugin.parser.settings.maxNumber}
ajax.40 < {$plugin.parser.settings.maxNumber}
ajax.50 < {$plugin.parser.settings.maxNumber}
ajax.60 = TEXT
ajax.60.data = {$field:flexform_varNum}
ajax.70 = TEXT
ajax.70.data = flexform : pi_flexform:settings.varNum
Can anyone give me a hint for the right syntax?
I'm using Typo3 9.5.13.
It is not possible to read out FlexForm data without an actual content element.
The CONTENT or COA objects would provide that. See for example Get FlexForm configuration in TypoScript
The feature was added in TYPO3 8.4 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.4/Feature-17309-AccessFlexformValueViaTS.html

Hide specific elements on page (Typoscript)

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.

Can I filter TT_NEWS in Typo3 by a date range?

I'm building a Typo3 website with the TT_NEWS extension; now I want to create a TT_NEWS list/latest view with a certain date range, but I cant find a way to do so.
I can't use the ARCHIVE function because I need a specific data range.
I hope that one of you knows the magic answer :-)
You can try setting an exact date range for the archive with TypoScript:
plugin.tt_news.amenuStart = 1.2.2003
plugin.tt_news.amenuEnd = 4.5.2006
This is assuming you only need one date range. For more than one range, maybe news categories would do the trick, but you'd need to assign them manually.
For tx_news use this in TypoScript:
1.settings.timeRestriction = 01.02.2003
1.settings.timeRestrictionHigh = 04.05.2006

Links at the start of content elements

TYPO3 adds these links at the start of almost every element:
<a id="c1427"></a>
where number is, I guess, UID of the element.
How TYPO3 render this link and is it possible to disable it for a specific FCE?
It depends on your TYPO3 Version. In 4.5 it is defined via:
tt_content.stdWrap.innerWrap.cObject.default.10.value = <div id="c{field:uid}"
If you use the TS-Objectbrowser, you should find it somewhere in tt_content.stdWrap.*
Depending on the rendering you are using, you could be able to add an if statement like:
tt_content.stdWrap.innerWrap.cObject.default.10 {
# check the uid of the content element which is rendered
if.isInList.field = uid
# do not render if content element uid is 1,2 or 44
if.value = 1,2,44
}
For sure, it depends on your configuration, so you cannot copy & paste. And i did not test this code! But it should show the way to go:)
I think your problem is in tt_content.stdWrap.prepend that is different for any languages different from default language.
Try to put this typoscript in your template:
tt_content.stdWrap.prepend >
tt_content.stdWrap.wrap = <div class="content-element">|</div>