TYPO3 8.6 categories in CEs - typo3

can you please tell me what is the adequate way to get the categories of a CE element in a fluid template ?
Thank you.

Ok, i did it that way in the TS:
lib.categories = CONTENT
lib.categories {
table = sys_category
select {
pidInList = 1
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 = |
}
}
}
And that way in the fluid template:
<div class="wrapper {f:if(condition: '{f:cObject(typoscriptObjectPath: \'lib.categories\', data: {recordUid: data.uid})} == 2', then: 'category', else: 'default')}"></div>

Related

TYPO3: check if current page is translated by typoscript

For the generation of the canonical tag by typoscript, I need to check if the current page is translated. If not, the canonical needs to point to the url in default language.
How can I check if current page is translated by typoscript?
Language handling in my typoscript config:
sys_language_overlay = 1
sys_language_mode = content_fallback
If anyone is interested, I have worked out a solution to my task: Render the canonical url in default language if there is no translation for the current page (content_fallback)
page.headerData.10 = COA
page.headerData.10 {
10 = LOAD_REGISTER
10.isPageTranslated.cObject = CONTENT
10.isPageTranslated.cObject {
table = pages
select {
selectFields = plo.sys_language_uid
pidInList = {$config.rootPid}
join = pages_language_overlay plo ON plo.pid = pages.uid
where = plo.pid = ###pid### AND plo.sys_language_uid = ###lang### AND plo.deleted = 0 AND plo.hidden = 0
markers {
pid.data = page:uid
lang.data = page:sys_language_uid
}
}
renderObj = TEXT
# translation available
renderObj {
wrap = <link rel="canonical" href="|">
typolink {
parameter.data = TSFE:id
returnLast = url
}
append = TEXT
append.value (
)
}
}
20 = TEXT
20 {
data = register:isPageTranslated
ifEmpty {
# no translation available
wrap = <link rel="canonical" href="|">
typolink {
parameter.data = TSFE:id
additionalParams = &L=0
returnLast = url
}
append = TEXT
append.value (
)
}
}
}

TYPO3 onepager all render all pages into one is not working

I want to render all pages into the template to make a onepager
I try this:
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/design/index.html
page.20.marks{
lib.sectionContent = HMENU
lib.sectionContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 4
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <section id="|">
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
}
wrap = <div class="container">|</div>
renderObj < tt_content
}
30 = TEXT
30 {
wrap = </section>
}
}
}
}
}
}
LANGMENU < temp.langMenu
In the Template File I have a section ###CONTENT###
And I want that all contents were printed there. How would that be possible?
You have a nesting error.
Your nesting currently looks like this (verify with the object browser):
page.20.marks.lib.sectionContent ...
However the the TEMPLATE object at page.20 checks only for keys in .marks.* and expects a valid content object (cObject) configuration there. However the valid key lib has no cObject set.
What you really try to do is this:
# prepare configuration for content
lib.sectionContent = HMENU
lib.sectionContent {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap >
stdWrap {
cObject = COA
cObject {
if.value = 4
if.equals.field = doktype
if.negate = 1
10 < temp.titleSectionId
10.wrap = <section id="|">
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
}
wrap = <div class="container">|</div>
renderObj < tt_content
}
30 = TEXT
30 {
wrap = </section>
}
}
}
}
}
}
# initialize configuration for the default page object
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/design/index.html
page.20.marks{
# copy the configuration from above to the right place
CONTENT < lib.sectionContent
# I really hope that you prepared temp.langMenu beforehand
LANGMENU < temp.langMenu
# close block for page.20.marks
}

Typo3 - get Headerlink in Navigation

i have an Menu, in this Menu i get the Data from a Col (colPos50) that work fine. But i also need the Headerlink from this page but it doesn't work.
50 = COA
50 {
###########
20 = CONTENT
20 {
table = tt_content
select {
pidInList.data = register:meinRegister
where = colPos=50
}
wrap = <div id="c{field:uid}">|Zum Vertrieb</div>
wrap.insertData = 1
}
###########
}
stdWrap.typolink {
wrap = <div class="linkwrap">|</div>
parameter.insertData = 1
parameter = {field:header_link}
ATagParams = class="headerLink"
ATagBeforeWrap = 1
}

How to add title to breadcrumb from the database of extention in typo3?

Using kickstart i created one extension for listing category and product.And i need to display the both category title/name & product title/name in my breadcrumb .At present i coded for calling from the database(" 40 = RECORDS") it is only showing the
RESULT :- HOME > Page Name »
My Url:-http://www.domain.com/page_name/
lib.breadcrumb=COA
lib.breadcrumb {
40 = RECORDS
40 {
dontCheckPid = 1
tables = TABLE_NAME
source.data = GPvar:tx_pi1_NAME|EXTKEY
conf.EXTKEY = TEXT
conf.EXTKEY.field = FIELD_NAME
wrap = » |
}
10 = HMENU
10 {
special = rootline
# "not in menu pages" should show up in the breadcrumbs menu
includeNotInMenu = 1
1 = TMENU
# no unneccessary scripting.
1.noBlur = 1
# Current item should be unlinked
1.CUR = 1
1.target = _self
1.wrap = <div class="breadcrumb-class"> | </div>
1.NO {
stdWrap.field = title
ATagTitle.field = nav_title // title
linkWrap = ||*| > |*|
}
# Current menu item is unlinked
1.CUR {
stdWrap.field = title
linkWrap = ||*| &nbsp>&nbsp&nbsp |*|
doNotLinkIt = 1
}
}
}
Here is an example from the news extension. You can use the same approach for your extension.
http://forge.typo3.org/projects/extension-news/wiki/Add_news_to_breadcrumb_menu
We can add field title to breadcrumb from the database of any extention that which we create in typo3.
lib.breadcrumb = COA
lib.breadcrumb {
stdWrap.wrap = <ul class="breadcrumb">|</ul>
entryLevel = 1
10 = HMENU
10 {
special = rootline
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
wrapItemAndSub = <li>|</li>
ATagTitle.field = subtitle // title
linkWrap = ||*| ›&nbsp |*|
stdWrap.htmlSpecialChars = 1
}
CUR <.NO
CUR {
wrapItemAndSub = <li class="active">|</li>
}
}
}
101=RECORD
101 {
tables = tx_table_name
source.data = GPvar:tx_plugin_name|param //param passing in the url
conf.tx_besiproduct_product = TEXT
conf.tx_besiproduct_product.field = field_name
conf.tx_besiproduct_product.required = 1
conf.tx_besiproduct_product.wrap = <li >|</li>
}
}

Typoscript content localization

I am developing a TYPO3 website with multilanguage support. I am using TemplaVoila for template mapping. Site works in both languages. But content added with Typoscript in TemplaVoila mapping is rendered only in default language, in other languages content from Typoscript is missing.
here is my typoscript:
lib.autherInfo = CONTENT
lib.autherInfo {
table = tt_content
select {
selectFields = cruser_id
}
renderObj = COA
renderObj {
10 = RECORDS
10{
source.field = cruser_id
tables = be_users
dontCheckPid = 1
conf.be_users = COA
conf.be_users {
10 = TEXT
10.field = realName
10.noTrimWrap = ||, |
15 = RECORDS
15{
source.field = usergroup
tables = be_groups
dontCheckPid = 1
conf.be_groups = COA
conf.be_groups {
10 = TEXT
10.field = title
10.noTrimWrap = ||, |
}
}
20 = TEXT
20.dataWrap = <span><a href="mailto:{field:email}" >{field:email}</a></span>
}
}
}
}
lib.autherInfo.wrap = <p>by:&nbsp|</p>
Output mark up of above typoscript is:
<p>by: Administrator, admin, <span>admin#kultur.com</span></p>
In other languages output is:
<p>by: </p>
How to fix this?
Your question is missing your typo3 language configuration. You can set a language fallback at least to get some output. Example configuration
config {
linkVars = L
sys_language_uid = 0
language = de
locale_all = de_DE
htmlTag_langKey = de
sys_language_mode = content_fallback
sys_language_overlay = hideNonTranslated
linkVars := addToList(L)
uniqueLinkVars = 1
// content fallback
sys_language_fallBackOrder = 1,0
sys_language_mode = content_fallback ; 1,0
sys_language_overlay = 1
sys_language_content = 1
}
Try setting
sys_language_overlay = hideNonTranslated
to
sys_language_overlay = 0