我想在 typoscript select 查询中获取一个变量
I want to get a variable in typoscript select Query
标题说明了一切;我需要一个带有动态 WHERE 子句的 Typoscript SQL SELECT 查询。
我得到当前登录用户的 UID:
data = TSFE:fe_user|user|uid
但是我如何在数据库查询中使用它呢?
我将 UID 存储在一个名为 {userID}
.
的拼写错误变量中
到目前为止,这是我的代码。问题是 Typoscript 只是合并两个值:
// User One has value: 50
// User Two has value: 32
// With this code the output is : 5032 ????
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
pidInList = 18
where = uid
andWhere.insertData = TSFE:fe_user|user|uid
selectFields = coins
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}
您应该使用 select
选项 markers
:
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
selectFields = coins
pidInList = 18
where = uid = ###UID###
markers {
UID.data = TSFE:fe_user|user|uid
}
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}
标题说明了一切;我需要一个带有动态 WHERE 子句的 Typoscript SQL SELECT 查询。
我得到当前登录用户的 UID:
data = TSFE:fe_user|user|uid
但是我如何在数据库查询中使用它呢?
我将 UID 存储在一个名为 {userID}
.
到目前为止,这是我的代码。问题是 Typoscript 只是合并两个值:
// User One has value: 50
// User Two has value: 32
// With this code the output is : 5032 ????
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
pidInList = 18
where = uid
andWhere.insertData = TSFE:fe_user|user|uid
selectFields = coins
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}
您应该使用 select
选项 markers
:
lib.coins = CONTENT
lib.coins {
table = fe_users
select {
selectFields = coins
pidInList = 18
where = uid = ###UID###
markers {
UID.data = TSFE:fe_user|user|uid
}
}
renderObj = COA
renderObj {
1 = TEXT
1.field = coins
}
}