typo3 - TYPO3 CONTENT 选择将参数传递给 USER/USER_INT
问题描述
排版:
lib.category = CONTENT
lib.category {
table=sys_category
select {
pidInList = root
selectFields = sys_category.*
join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
where.field = sys_category_record_mm.uid_foreign = data.uid
languageField = 0
}
renderObj = USER_INT
renderObj {
userFunc = InstantAitExt\AitContacts\GetPageCategories->testExecute
alias = TEXT
alias.value = data.uid
}
}
所以我必须将 1-x 参数传递给 testExecute。其中一个参数应该保存给定页面的 uid。这个 uid 被传递给 lib.category=CONTENT 通过
<f:cObject typoscriptObjectPath="lib.category" data="{page}" />
data.uid
基本上是这样page.data.uid
问题是如果我传递data.uid
给alias.value
参数,则将“data.uid”作为字符串而不是我需要的实际值。
那么如何将实际的 pageId 传递给 alias.value
此外,查询有效,但我无法验证/调试
where.field = sys_category_record_mm.uid_foreign = data.uid
检查查询是否真的得到正确的值(视图中的页面 id)
非常感谢帮助
解决方案
您无法调试它,因为它是语法错误。
该属性是where
,如果您使用where.field
,您想从(当前上下文的)字段中设置值。在等号之后是字段的名称。
但是你给个表情sys_category_record_mm.uid_foreign = data.uid
。那无法评价。
你想要的是一个带有数据的表达式。这个数据应该被替换。
因此,您可以对替换的数据(或字段)使用换行
where.data = data.uid
where.wrap = sys_category_record_mm.uid_foreign = |
这等于
where.field= uid
where.wrap = sys_category_record_mm.uid_foreign = |
与data
当前上下文一样,因此您可以直接访问该字段。
或者您使用insertData
:
where = sys_category_record_mm.uid_foreign = {data.uid}
where.insertData = 1
编辑:
如果您只想将页面 uid 提交给您可以使用的打字稿视图助手
<f:cObject typoscriptObjectPath="lib.category" data="{page.uid}" />
或一个简单的数组,例如:
<f:cObject typoscriptObjectPath="lib.category" data="{uid:page.uid}" />
而第二次调用不会更改上面的打字稿(您只有一个较小的data
数组,其中仅包含该字段uid
,而原始调用包含整个页面记录)。
对于只有 uid 值的 viewhelper,您必须使用current
:
where = current
where.wrap = sys_category_record_mm.uid_foreign = |
推荐阅读
- python - Python/Flask/JS - 显示等待屏幕并在等待 5 秒后继续
- azure-cosmosdb - 在 Cosmos DB 中存储大型 Json
- arm - arm-none-eabi-gdb:加载共享库时出错:libncurses.so.5:无法打开共享对象文件:没有这样的文件或目录
- azure - 用于 azure 的 terraform 本地和查找帮助
- latex - 为 PDF LATEX 自定义 doxygen 输出
- javascript - 如何在 Node.js 中获取上传文件的路径和名称
- android - RippleDrawable 在 RecyclerView 中未显示正确的状态
- git - 如何在mac终端输入Bitbucket密码?
- python - 如何在 Event Hub 的存储帐户中列出最新的 AVRO blob?
- swiftui - @ViewBuilder 闭包的默认值?