TYPO3 Menu with categories? - typo3

How can I add the categories to each page of my menu element?
I have been trying different combinations of DatabaseQueryProcessor but the array comes through empty.
This is what I currently have based on other examples:
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = list
special.value.field = pages
levels = 2
as = menuItems
expandAll = 1
includeNotInMenu = 1
titleField = nav_title // title
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
20 {
if.isTrue.field = categories
table = sys_category
pidInList = root,-1
selectFields = sys_category.*
where.data = field:_ORIG_uid // field:uid
as = categories
}
}
}
}

The pidInList needs to be the page where the categories are stored.
20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
20 {
if.isTrue.field = categories
table = sys_category
selectFields = sys_category.*
pidInList = 55
recursive = 999
join = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
where.data = field:_ORIG_uid // field:uid
where.intval = 1
where.wrap = sys_category_record_mm.uid_foreign=|
as = categories
}

Related

TYPO3 empty body tag

I did a upgrade from 9.5 to 10.4 and i guess Typoscript is not working right. There are no errors displayed (also the log files..)
The Header is rendering right but the Body-Tag stays empty.
I'm kinda lost right now.. it's always a pleasure upgrading Typo3.
Any Idea? Are there any Typoscript Tags which are out of date?
config {
absRefPrefix = /
disableBodyTag = 1
metaCharset = utf-8
prefixLocalAnchors = all
contentObjectExceptionHandler = 0
}
# HEADER MAINNAV MENU
headermainnav = HMENU
headermainnav {
entryLevel = 0
1 = TMENU
1 {
wrap = <ul>|</ul>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li class="active">|</li>
}
}
2 < .1
}
# LANGUAGE SELECTOR
languagemenu = COA
languagemenu {
20 = HMENU
20 {
special = language
special.value = 0,2
special.normalWhenNoLanguage = 0
wrap =
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
doNotLinkIt = 1
linkWrap = <li>|</li>
stdWrap.override = DE || EN
stdWrap {
typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=2
ATagParams = hreflang="de-DE" || hreflang="en-GB"
addQueryString = 1
addQueryString.exclude = L,id,no_cache
addQueryString.method = GET
no_cache = 0
}
}
}
ACT < .NO
ACT.linkWrap = <li class="active">|</li>
USERDEF1 < .NO
USERDEF1 {
linkWrap = <li class="text-muted">|</li>
stdWrap.typolink >
}
USERDEF2 < .ACT
USERDEF2 {
linkWrap = <li class="text-muted">|</li>
stdWrap.typolink >
}
}
}
wrap = <ul id="language_menu" class="language-menu">|</ul>
}
# FOOTER MAINNAV MENU
footermainnav = HMENU
footermainnav {
entryLevel = 0
excludeUidList = 2,3,4,5,6
1 = TMENU
1 {
wrap = <ul>|</ul>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li class="active">|</li>
}
}
2 < .1
}
page = PAGE
page {
# set baseURL on the flow
headerData.5 = TEXT
headerData.5.data=getIndpEnv:HTTP_HOST
headerData.5.wrap = <base href="{$websiteConfig.protocol}://|/"></base>
meta {
description = page:description
viewport = width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no
X-UA-Compatible = IE=edge
X-UA-Compatible.attribute = http-equiv
}
shortcutIcon = fileadmin/t3/img/favicon.png
includeCSS {
googlefontscss = https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,600,600i,800,800i|Oswald:500
googlefontscss.external = 1
file1 = fileadmin/t3/css/normalize.css
file2 = fileadmin/t3/css/grid12.css
file3 = fileadmin/t3/css/slick.min.css
file4 = fileadmin/t3/css/style.css
file5 = fileadmin/t3/custom.css
}
includeJS {
file1 = fileadmin/t3/js/jquery.min.js
}
includeJSFooter {
file2 = fileadmin/t3/js/lottie.min.js
file3 = fileadmin/t3/js/slick.min.js
file4 = fileadmin/t3/script.js
file5 = fileadmin/t3/js/custom.js
}
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/t3/layout.html
relPathPrefix = fileadmin/t3/
workOnSubpart = DOCUMENT
substMarksSeparately = 1
marks {
COPYRIGHT = TEXT
COPYRIGHT {
data = date : U
strftime = %Y
noTrimWrap = |© | TYPO3 All Rights Reserved.|
}
BODYTAG = TEXT
BODYTAG.insertData = 1
BODYTAG.dataWrap = <body class="no-touch" data-page="{tsfe:id}">
CONTACTFORM = CONTENT
CONTACTFORM {
table = tt_content
select {
pidInList = 23
includeRecordsWithoutDefaultTranslation = 1
}
}
HEADERMAINNAV < headermainnav
LANGUAGESELECTOR < languagemenu
FOOTERMAINNAV < footermainnav
CONTENT = CONTENT
CONTENT {
table = tt_content
select {
languageField = 1
orderBy = sorting
includeRecordsWithoutDefaultTranslation = 1
}
}
NEWSBANNER = CONTENT
NEWSBANNER {
table = tt_content
select {
pidInList = 47
includeRecordsWithoutDefaultTranslation = 1
}
}
COOKIEHINTCONTENT = CONTENT
COOKIEHINTCONTENT {
table = tt_content
select {
pidInList = 14
includeRecordsWithoutDefaultTranslation = 1
}
}
IMPRINTCONTENT = CONTENT
IMPRINTCONTENT {
table = tt_content
select {
pidInList = 16
includeRecordsWithoutDefaultTranslation = 1
}
}
PRIVACYCONTENT = CONTENT
PRIVACYCONTENT {
table = tt_content
select {
pidInList = 17
includeRecordsWithoutDefaultTranslation = 1
}
}
JOBROWS = CONTENT
JOBROWS {
table = tt_content
select {
pidInList = 27
orderBy = sorting
includeRecordsWithoutDefaultTranslation = 1
}
}
DOWNLOADS_DE = CONTENT
DOWNLOADS_DE {
table = tt_content
select {
pidInList = 31
where = sys_language_uid = 0
languageField = 0
orderBy = sorting
includeRecordsWithoutDefaultTranslation = 1
}
}
DOWNLOADS_EN = CONTENT
DOWNLOADS_EN {
table = tt_content
select {
pidInList = 31
where = sys_language_uid = 2
languageField = 0
orderBy = sorting
}
}
FAQDATA = CONTENT
FAQDATA {
table = tt_content
select {
pidInList = 34
orderBy = sorting
includeRecordsWithoutDefaultTranslation = 1
}
}
}
}
}
Keep in mind that TEMPLATE, MARKERS and SUBPARTS will be removed in TYPO3 11.
the 10.template = FILE was removed in TYPO3 10.
You will have to switch to FLUID.
Read more here: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/ContentObjects/Template/Index.html
10 = FLUIDTEMPLATE
10 {
# also dynamic with .stdWrap
templateName = TemplateName
layoutRootPaths {
# if you set <f:layout name="Whatever" /> in your template, create Whatever.html there
10 = fileadmin/t3/Layouts/
}
partialRootPaths {
10 = fileadmin/t3/Partials/
}
templateRootPaths {
# make sure you have TemplateName.html inside (whatever templateName will be)
10 = fileadmin/t3/Templates/
}
variables {
# use as {copyright} in template
copyright = TEXT
copyright{
data = date : U
strftime = %Y
noTrimWrap = |© | TYPO3 All Rights Reserved.|
}
}
}
// untested, but should be right

TYPO3 News Title in breadcrumb with MenuProcessor

is it possible to show the current news title in breadcumb with the MenuProcessor?
I've tried some with DatabaseQueryProcessor but I don't get the data.
Have someone a working example or a tutorial for me?
At the moment I have only this:
temp.breadcrumb = FLUIDTEMPLATE
temp.breadcrumb {
templateName = breadcrumb
templateRootPaths {
10 = fileadmin/resources/private/template/menu/
}
partialRootPaths {
10 = fileadmin/resources/private/template/partials/
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = rootline
special.range = 0|-1
includeNotInMenu = 1
as = menuBreadcrumb
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = records
table = tx_news_domain_model_news
}
}
}
}

I want to override in typoscript CONTENT or renderObj with noting

I have a little problem, the following code works, but to not show what I do not want to display, I'm forced to put style =" display: none " with invalid HTML code, because I'm in <ul> <li> ... </ ul>. How could I not display anything at all?
40 = CONTENT
40 {
table = tt_content
select {
orderBy = sorting
pidInList.field = uid
where = {#colPos}=99 and deleted = 0 and hidden = 0
}
renderObj = COA
renderObj {
20 = TEXT
20.stdWrap.field = header
20.stdWrap.wrap = <b>|</b>
# OVERRIDE for <ul><li> ...
20.stdWrap.wrap.override = <span style="display:none">|</span>
20.stdWrap.wrap.override.if.value = 1
20.stdWrap.wrap.override.if.equals.dataWrap = {register:typeOfMenu}
30 = TEXT
30.stdWrap.field = bodytext
30.stdWrap.wrap = <i>|</i>
# OVERRIDE for <ul><li> ...
30.stdWrap.wrap.override = <span style="display:none">|</span>
30.stdWrap.wrap.override.if.value = 1
30.stdWrap.wrap.override.if.equals.dataWrap = {register:typeOfMenu}
40 = FILES
40 {
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
begin = 0
maxItems = 1
renderObj = IMAGE
renderObj {
file {
import.data = file:current:originalUid // file:current:uid
#width = 232c
#height = 145c
}
required = 1
wrap = <div class="img-wrap">|</div>
}
}
# OVERRIDE for <ul><li> ...
40.stdWrap.wrap.override = <span style="display:none">|</span>
40.stdWrap.wrap.override.if.value = 1
40.stdWrap.wrap.override.if.equals.dataWrap = {register:typeOfMenu}
}//COA
}//CONTENT
In fact, I tried a lot of stuff before resigning myself to <span style =" display: none "> | </ span>, do you have a better solution?
Best regards
Did you try these propositions?
40.renderObj.40.if {
value = 1
equals.dataWrap = {register:typeOfMenu}
}
or
40.renderObj.40.stdWrap.if {
value = 1
equals.dataWrap = {register:typeOfMenu}
}
if that's not working you've to check if the register is filled with any data, you can check that just by rendering it too in 40.renderObj.50:
40.renderObj.50 = TEXT
40.renderObj.50.data = {register:typeOfMenu}
As it seems that {register:typeOfMenu} is defined outside that CONTENT and you want to render the whole block only if {register:typeOfMenu}=1 you could also note it like this:
40 = CONTENT
40 {
table = tt_content
select {
orderBy = sorting
pidInList.field = uid
where = {#colPos}=99 and deleted = 0 and hidden = 0
}
renderObj = COA
renderObj {
20 = TEXT
20.stdWrap.field = header
20.stdWrap.wrap = <b>|</b>
30 = TEXT
30.stdWrap.field = bodytext
30.stdWrap.wrap = <i>|</i>
40 = FILES
40 {
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
begin = 0
maxItems = 1
renderObj = IMAGE
renderObj {
file {
import.data = file:current:originalUid // file:current:uid
#width = 232c
#height = 145c
}
required = 1
wrap = <div class="img-wrap">|</div>
}
}
}//COA
stdWrap.if {
value = 1
equals.dataWrap = {register:typeOfMenu}
}
}//CONTENT
Sorry, but I did not put all the code, there was before a COA. Now, thanks to your advice I have solved the problem. Here is the complete code:
NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.wrap = <h1>|</h1>
10.field = nav_title // title
10.typolink.parameter.field = uid
# OVERRIDE for <ul><li> ...
10.wrap.override = <li class="laclasse">|
10.wrap.override.if.value = 1
10.wrap.override.if.equals.dataWrap = {register:typeOfMenu}
40 = CONTENT
40 {
table = tt_content
select {
orderBy = sorting
pidInList.field = uid
where = {#colPos}=99 and deleted = 0 and hidden = 0
}
renderObj = COA
renderObj {
20 = TEXT
20.stdWrap.field = header
20.stdWrap.wrap = <b>|</b>
30 = TEXT
30.stdWrap.field = bodytext
30.stdWrap.wrap = <i>|</i>
40 = FILES
40 {
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
begin = 0
maxItems = 1
renderObj = IMAGE
renderObj {
file {
import.data = file:current:originalUid // file:current:uid
#width = 232c
#height = 145c
}
required = 1
#wrap = <div class="img-wrap">|</div>
titleText.data = page:subtitle
altText.data = page:subtitle
stdWrap.typolink.parameter.data = leveluid:0
}
}
}//COA
}//CONTENT
}//COA
# OVERRIDE for <ul><li> ...
stdWrap.cObject.40.if {
value = 1
equals.dataWrap = {register:typeOfMenu}
negate = 1
}
Thanking you,
Best regards

My manually built TYPO3 lightbox isn't working properly

In a COA, I have this TypoScript to add an image linked to a larger copy of itself. But the Javascript plugin I'm using (Colorbox) isn't able to resize the image properly.
20 = CONTENT
20 {
wrap = <div class="lightbox clearfix">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.where = colPos = 2
select.selectFields = bodytext,image,header
renderObj=COA
renderObj{
10 = FILES
10 {
required = 1
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid // file:current:uid
file.width=300c
file.height=300c
imageLinkWrap = 1
imageLinkWrap {
enable = 1
width = 1600m
height = 1600m
JSwindow = 0
linkParams.ATagParams {
// title.data =
dataWrap = class = "lightbox-group" title="{file:current:description}"
}
}
}
}
}
}
What's up?
Here's the correct TypoScript. I'm sharing it because it is a legacy weirdness others might stumble upon too.
You have to set imageLinkWrap.directImageLink = 1, else imageLinkWrap won't deliver the image itself, but a HTML page containing that image!
20 = CONTENT
20 {
wrap = <div class="lightbox clearfix">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.where = colPos = 2
select.selectFields = bodytext,image,header
renderObj=COA
renderObj{
10 = FILES
10 {
required = 1
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid // file:current:uid
file.width=300c
file.height=300c
imageLinkWrap = 1
imageLinkWrap {
enable = 1
width = 1600m
height = 1600m
directImageLink = 1
JSwindow = 0
linkParams.ATagParams {
// title.data =
dataWrap = class = "lightbox-group" title="{file:current:description}"
}
}
}
}
}
}

Split HMENU-Text in Typo3

i've configured typo3 to enable a multi-line navigation title. So if there is a linebreak there should be also a linebreak in the menu-link.
I'm splitting the Text with the following code
30 = COA
30.10 = TEXT
30.10 {
field = {nav_title//title}
listNum = 0
listNum.splitChar = 13
}
30.20 < .30.10
30.20.listNum = 1
30.20.wrap = <br />|
30.20.required = 1
My Menu-Creation basicily the following
1 = TMENU
1.expAll = 1
1.NO {
doNotLinkIt = 1
stdWrap.override.cObject =TEXT
stdWrap.override.cObject {
typolink.parameter.field = uid
if.isTrue.numRows {
table = tt_content
select {
pidInList.field = uid
where = colPos = 0
}
}
}
}
The stdWrap.override-Block disables clickable links if the page if there is no content for the page.
Now to my question: It feels that i'm too dumb to merge those parts - How is it done the right way?
Guessing, untested:
1 = TMENU
1.expAll = 1
1.NO {
doNotLinkIt = 1
stdWrap.override.cObject = COA
stdWrap.override.cObject {
10 = TEXT
10 {
field = {nav_title//title}
listNum = 0
listNum.splitChar = 13
}
20 < .30.10
20 {
listNum = 1
wrap = <br />|
required = 1
}
typolink.parameter.field = uid
if.isTrue.numRows {
table = tt_content
select {
pidInList.field = uid
where = colPos = 0
}
}
}
}