问题描述
我尝试在我的FLUID模板上将类别uid或名称显示为 class = category.uid
。
I try to show my category uid or name as a class="category.uid"
at my FLUID template.
如果我尝试< f:debug> {data}< / f:debug>
,我将看到类似以下的输出:类别=> '1'(1个字符)
If I try <f:debug>{data}</f:debug>
I'll see there are an output like: categories => '1' (1 chars)
但是如何将category-uid或-name写入我的FLUID / HTML中,类似这样:
But how can I write the category-uid or -name into my FLUID/HTML, similar like this:
<div id="container" class="{data.nav_title}">
<!-- I need the categories -->
<div id="container" class="{categories.uid}">
感谢您的帮助。
编辑:一些屏幕截图
信息在表 sys_category
title,uid,pid ..
some screenshotsThe info is in table sys_category
title, uid, pid ..
- `{data}
推荐答案
我在这里使用了另一种解决方案:如何在Typo3 C的流体中获取类别对象
I have used a variant of the solution here: How can I get the category object in Fluid of Typo3 Content Element Pictures?
TypoScript
lib.categories = CONTENT
lib.categories {
table = sys_category
select {
pidInList = root
selectFields = sys_category.uid
join = sys_category_record_mm on sys_category_record_mm.uid_local = sys_category.uid
where.field = recordUid
where.wrap = sys_category_record_mm.uid_foreign=|
}
renderObj = COA
renderObj {
1 = TEXT
1 {
field = uid
stdWrap.noTrimWrap = | cat-||
}
}
}
流体模板
<f:cObject typoscriptObjectPath="lib.categories" data="{recordUid: data.uid}" />
这篇关于TYPO3在FLUID模板(sys_category)中获取类别uid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!