我有自己的扩展名,前端用户可以使用该扩展名创建自己的记录。然后,应在用户详细信息页面上显示用户的所有条目。
在我的“显示”模板中,有一个变量{user.uid},我可以使用它来访问用户UID。如何将其纳入我的打字稿中?
打字稿
lib.getuserItems = CONTENT
lib.getuserItems {
table = tx_myext_domain_model_item
select {
selectFields = crdate,image,message,uid,deleted
pidInList = 2
orderBy = crdate DESC
where.data =
where.dataWrap = ((tx_myext_domain_model_item.author_ident = '{user.uid}')) AND deleted = 0 AND NOT tx_myext_domain_model_item.parent_item
}
流体
<f:cObject typoscriptObjectPath="lib.getuserItems" data="{user.uid}" />
答案 0 :(得分:0)
如果数据是单个值(而不是数组或对象),则可以在TypoScript中将其用作current
值。因此,您的TypoScript应该是:
lib.getuserItems = CONTENT
lib.getuserItems {
table = tx_myext_domain_model_item
select {
selectFields = crdate,image,message,uid,deleted
pidInList = 2
orderBy = crdate DESC
where.current = 1
// ensure it's an integer
where.intval = 1
where.wrap = ((tx_myext_domain_model_item.author_ident = '|')) AND deleted = 0 AND NOT tx_myext_domain_model_item.parent_item
}
}