TYPO3 ignores Language in categories select - typo3

I am selecting categories on an English page. The categories have the language ID 0. English is ID 1.
But I need the same categories on both languages.
cheese = CONTENT
cheese {
wrap = <cheese_legend>|</cheese_legend>
table = sys_category
select {
pidInList = {$categories}
selectFields = *
where = deleted = 0
andWhere = sys_language_uid = 0
andWhere = hidden = 0
}
renderObj = COA
renderObj {
wrap = <cat>|</cat>
10 = TEXT
10 {
stdWrap.field = uid
stdWrap.wrap = <div>|</div>
}
20 = TEXT
20 {
stdWrap.field = title
stdWrap.wrap = <div>|</div>
}
30 = TEXT
30 {
stdWrap.field = sys_language_uid
stdWrap.wrap = <div>|</div>
}
}
}
So I'm explicitly selecting the sys_language_uid = 0!!
But nevertheless the script only gives me results with the ID = 1.
Any idea to make this baby work?

You have doubled the andWhere = statement, so the one below overwrites the one above.
Use andWhere = sys_language_uid = 0 AND hidden = 0 in one line.
For getting the english ones you use andWhere = sys_language_uid = 1 AND hidden = 0.

Related

Why does noTrimWrap not work in the following TypoScript?

Wrap works, but need the spaces for better presentation, unfortunately it doesn't work with "noTrimWrap" :-(
I use Typo3 9.5.10
I hope someone can help me :-)
myTicker = CONTENT
myTicker {
wrap = |
table = tx_myPlugin_domain_model_tick
select {
pidInList = 31
max = 4
selectFields = dbfield_1, dbfield_2
}
renderObj = COA
renderObj {
10 = TEXT
10.field = dbfield_1
20 < .10
20.field = dbfield_2
noTrimWrap = |<div>+++ Neuer Eintrag: | +++</div>|
}
}
COA does not have a direct stdWrap on the root level. This should work though:
myTicker = CONTENT
myTicker {
wrap = |
table = tx_myPlugin_domain_model_tick
select {
pidInList = 31
max = 4
selectFields = dbfield_1, dbfield_2
}
renderObj = COA
renderObj {
10 = TEXT
10.field = dbfield_1
20 < .10
20.field = dbfield_2
stdWrap.noTrimWrap = |<div>+++ Neuer Eintrag: | +++</div>|
}
}

Get list of feusers with typoscript, can't get the names of the associated usergroups

I am generating this list of feusers and trying to get the names of the associated usergroups. This code worked before the update to TYPO3 8.x (it's just the relevant part of the whole thing):
40 = TEXT
40.field = usergroup
40.split {
token = ,
cObjNum = 1 || 2
1 {
10 = CONTENT
10.table = fe_groups
10.select.pidInList = 22
10.select.andWhere.current = 1
10.select.andWhere.wrap = uid=|
10.select.where = (title NOT LIKE 'Netzwerk')
10.renderObj = TEXT
10.renderObj.field = title
10.renderObj.wrap = |, <br />
}
2 < .1
2.10.renderObj.wrap >
}
With TYPO3 8 the 'andWhere' is depreciated and so I tried like this, but failed:
40 = TEXT
40.field = usergroup
40.split {
token = ,
cObjNum = 1 || 2
1{
10 = CONTENT
10 {
table = fe_groups
select {
pidInList = 22
where.current = 1
where.wrap = uid= |
}
10.renderObj = TEXT
10.renderObj.field = title
10.renderObj.wrap = |,
}
2 < .1
2.10.renderObj.wrap
}
}
Thanks for pointing me in the right direction.
You should not split up the comma separated values, but go for uidInList instead. This way you get rid of the surrounding split and fetch the elements within just one go.
40 = CONTENT
40 {
table = fe_groups
select {
uidInList.field = usergroup
pidInList = 22
}
renderObj = TEXT
renderObj.field = title
renderObj.wrap = |,
}

get Image from Pageproperties into an HMENU

I have an HMENU in Typo3, in the Pageproperties i have stored an image. How can i show the Image from the Pageproperties in ne Menu? I have no Idea, why the image is not displayed.
Typo3 6.2
lib.produkt_start = HMENU
lib.produkt_start {
special = directory
special.value = 3
wrap = |
1 = TMENU
1 {
expAll = 1
NO = 1
NO {
allWrap = <div class="patterns col4" id="page_{field:uid}">|</div>
allWrap.insertData = 1
ATagParams = id="uid{field:uid}"
ATagParams.insertData = 1
stdWrap.cObject >
stdWrap.cObject = COA
stdWrap.wrap = |
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia-1, slide
30.treatIdAsReference = 1
30.import.listNum = 0
30.wrap = <h5>|</h5>
}
}
ACT = 1
ACT < .NO
}
}
I tested your problem with TYPO3 6.1.7
First of all you have to correct you code a little:
[...]
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
30.wrap = <h5>|</h5>
}
[...]
Now it will be "working" but only if you actually set an image in media field of the parent page, then it will be renderd in all child pages, ignoring the fact that the child pages have an own image set - I would consider this as sort of a bug of TMENU or TMENUITEM, but I haven't realy testet it fully.
You will get a problem with entity encoding of the title as well so I would try this option:
stdWrap.wrap.cObject = COA
stdWrap.wrap.cObject {
10 = TEXT
10.value = <br><h2>|</h2>
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
}
Strange is that the following does not work either:
30.file.import.field = media
This makes my suspition of the wrong slide behaviour above being a bug even stronger.

TYPO3 title tag from page title and tt_news category title

I have couple of tt_news category items and subpages on which these categories belong, for example:
www.example.com/typo3/category/typoscript.html - id=1
www.example.com/other/category/seo.html - id=2
I have following TS who "connect" page title and category name:
[globalVar = TSFE:id = 1]
temp.newsTitle = RECORDS
temp.newsTitle {
source = {GP:tx_ttnews|cat}
source.insertData = 1
tables = tt_news_cat
conf.tt_news_cat >
conf.tt_news_cat = TEXT
conf.tt_news_cat.field=title
wrap = <title>TYPO3 -|</title>
}
page.config.noPageTitle = 2
page.headerData.30 >
page.headerData.30 < temp.newsTitle
[global]
[globalVar = TSFE:id = 2]
temp.newsTitle = RECORDS
temp.newsTitle {
source = {GP:tx_ttnews|cat}
source.insertData = 1
tables = tt_news_cat
conf.tt_news_cat >
conf.tt_news_cat = TEXT
conf.tt_news_cat.field=title
wrap = <title>Other -|</title>
}
page.config.noPageTitle = 2
page.headerData.30 >
page.headerData.30 < temp.newsTitle
[global]
In output the title of pages looks like this:
TYPO3 - TypoScript
Other - SEO
Is it possible to connect those two values globally (without globalVar = TSFE:id = 3)?
I try with these but it didn't work:
[globalVar = GP:tx_ttnews|cat > 0]
lib.newsTitle = COA
lib.newsTitle {
10 = TEXT
10.field = title
10.noTrimWrap = ||: |
20 = RECORDS
20 {
source = {GP:tx_ttnews|cat}
source.insertData = 1
tables = tt_news_cat
conf.tt_news_cat >
conf.tt_news_cat = TEXT
conf.tt_news_cat.field=title
}
wrap = <title>|</title>
}
page.config.noPageTitle = 2
page.headerData.30 >
page.headerData.30 < temp.newsTitle
[global]
What about insertData in the wrap?
temp.newsTitle = RECORDS
temp.newsTitle {
source = {GP:tx_ttnews|cat}
source.insertData = 1
tables = tt_news_cat
conf.tt_news_cat >
conf.tt_news_cat = TEXT
conf.tt_news_cat.field=title
stdWrap.wrap = <title>{page:title} -|</title>
stdWrap.insertData = 1
}
If it works, maybe even try without stdWrap.

Select with TypoScript with condition

I got this condition:
[globalVar = TSFE:fe_user|sesData|get_car = Katowice]
get_carpid = TEXT
get_carpid.value = 27
[global]
And this select:
plugin.Tx_Formhandler.settings.predef.formhandler-multistep-forms.markers.input_readonly_a_price = CONTENT
plugin.Tx_Formhandler.settings.predef.formhandler-multistep-forms.markers.input_readonly_a_price {
table = tx_pricelist_prices_full
select {
pidInList = 27
orderBy = uid
selectFields = uid, group_a_1_3
# possible conditions
where = ( tx_pricelist_prices_full.uid='1' AND hidden='0' AND deleted='0')
}
renderObj = COA
renderObj {
#value
1 = TEXT
1.insertData = 1
1.data = field:group_a_1_3
2 = TEXT
2.value = *
3 = TEXT
3.insertData = 1
3.data = TSFE:fe_user|sesData|finish_day
stdWrap.prioriCalc = 1
}
}
How to use defined get_carpid in SELECT in line pidInList = get_carpid
Thanks for any help!
You can create a cObject CASE. But this will only work for [a-zA-z0-9_-]
# TS Setup
... snip ...
pidInList.cObject = CASE
pidInList.cObject {
key.data = TSFE:fe_user|sesData|get_car
key.case = lower
default = TEXT
default.value = 0
# special chars are not allowed
katowice = TEXT
katowice.value = 27
}
... snip ...
A different possibility is to use constants:
# TS Constants
[globalVar = TSFE:fe_user|sesData|get_car = Katowice]
get_carpid = 27
[globalVar = TSFE:fe_user|sesData|get_car = Lublin]
get_carpid = 28
[global]
# TS Setup
... snip ...
pidInList = {$get_carpid}
... snip ...
The first solution is more TypoScript fun, the second easier for novice - i guess :)