I try to show my category uid or name as a class="category.uid"
at my FLUID template.
If I try <f:debug>{data}</f:debug>
I'll see there are an output like: categories => '1' (1 chars)
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}">
THanks for your help.
EDIT: some screenshots
The info is in table sys_category
title, uid, pid ..
- `{data}
The same problem is discussed here (see 11:30 - 12:31).
So there is no viewhelper for this. You have to register a ContentController with Flux.
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-||
}
}
}
Fluid Template
<f:cObject typoscriptObjectPath="lib.categories" data="{recordUid: data.uid}" />
Sorry for the answer - i do not have enough reputation to comment.
What is {data}
?
Is it something you get from your controller like?
$data = $this->configurationManager->getContentObject()->data;
$this->view->assign('data', $data);
If so, then you will need to do some extra processing in your controller since $data
is an associated array and not an object / model with injection of relations.