I want to use a conditional statement for applying a different template to News (tt_news). Currently I use a user function that returns true/false. If the current News has a specific category and works correctly return 1 otherwise return Null.
I followed the official documentation and other sites, so I made the condition
[userFunc = user_isLatin]
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/latin_detail.html
page.1010 = TEXT
page.1010.value = LATIN
[ELSE]
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/general_detail.html
page.1010 = TEXT
page.1010.value = OTHERS
[END]
but it always shows OTHERS. I tried the following with variables
temp.catuid = USER
temp.catuid.preUserFunc = user_ttNewsInCat
latin = TEXT
latin.value < temp.catuid
[latin.value = 1]
....
[ELSE]
....
[END]
but it doesn't work either.
It works exactly like you tried to do it. This is the cobndition I tested now:
And this is the implementation of the user function which must be in the AdditionalConfiguration.php or the localcon.php file of your custom extension (I suppose this is what you missed).
For more details see the offcial documentation: https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/Conditions/Reference/Index.html#userfunc