Typo3 - TMENU get Content from Colpos - typo3

i have an TMENU, in that Menu I would have the Content from the Subpages in the Menu. On every Page is an Col (colpos=0) with Content. Is it possible to get the Content from there to the Menu?
lib.mainmenu = HMENU
lib.mainmenu {
1 = TMENU
1 {
wrap = <ul id="mainmenu">|</ul>
expAll = 1
NO {
wrapItemAndSub = <li>|</li>
ATagParams = class="drop"
}
}
2 = TMENU
2 {
wrap = <div class="dropdown_produkte"><div class="nav-tabs"><ul>|</ul></div></div>
NO {
wrapItemAndSub = <li>|</li>
}
2.40 = CONTENT
2.40 {
table = tt_content
select.pidInList.field = pid
select.where = colPos=0
select.languageField=sys_language_uid
wrap = <div class="teaser">|</div>
}
}
}

There is already such a menu defined in css_styled_content
typo3/sysext/css_styled_content/static/setup.txt
# "Menu of subpages to these pages + sections - liststyle"
7 < .1
7 {
stdWrap {
outerWrap = <ul class="csc-menu csc-menu-7">|</ul>
}
1.expAll = 1
2 < .1
2 {
sectionIndex = 1
sectionIndex.type = header
wrap = <ul>|</ul>
NO.wrapItemAndSub = <li class="csc-section">|</li>
}
}
If you are going to use typoscript in your project (wich you hardly need anymore when you develope with fluid + vhs) than css_styled_content is always a good reference point

Here is my Solution
lib.mainmenu = HMENU
lib.mainmenu {
1 = TMENU
1 {
wrap = <ul id="mainmenu">|</ul>
expAll = 1
NO {
wrapItemAndSub = <li>|</div></li>
ATagParams = class="drop"
}
submenuObjSuffixes = a || b || c || d || e
}
2a < .1
2a {
wrap = <div class="dropdown_produkte">|</div>
stdWrap.cObject = COA
stdWrap.cObject {
20 = HMENU
20 {
special = directory
special.value.data = field:pid
1 = TMENU
1 {
expAll = 1
wrap = <div class="nav-tabs"><ul>|</ul>
NO {
wrapItemAndSub = <li>|</li>
#stdWrap.dataWrap = <h2>|</h2>
#linkWrap = | |*| /
ATagParams = class=submenu
}
ACT < .NO
ACT = 1
ACT {
ATagParams = class=submenuActive
}
RO < .ACT
}
}
40 = CONTENT
40 {
table = pages
select {
pidInList.field = pid
orderBy = sorting
}
renderObj = COA_INT
renderObj {
10 = TEXT
#10.field = title
10.wrap = |
20 = LOAD_REGISTER
20 {
meinRegister.cObject = TEXT
meinRegister.cObject.field = uid
}
50 = COA
50 {
###########
20 = CONTENT
20 {
table = tt_content
select {
pidInList.data = register:meinRegister
where = colPos=0
}
}
###########
}
}
}
}
}
}

As I faced a similar issue today, I wanted this question to be up to date. (Using TYPO3 8.7.4 with fluid_styled_content.)
lib.mainmenu = HMENU
lib.mainmenu {
1 = TMENU
1 {
wrap = <ul id="mainmenu" class="level1">|</ul>
expAll = 1
NO {
wrapItemAndSub = <li>|</li>
ATagParams = class="drop"
}
}
2 < .1
2 {
wrap = <div class="wrapper">|</div>
stdWrap.innerWrap = <ul class="level2">|</ul>
stdWrap.append = CONTENT
stdWrap.append {
table = tt_content
select {
pidInList.field = pid
where = colPos = 5 and deleted = 0 and hidden = 0
}
stdWrap.wrap = <div class="content">|</div>
}
}
3 < .2
3 {
NO.wrapItemAndSub = <li>|</li>
wrap = <ul class="level3">|</ul>
stdWrap.append >
}
}
That way (of course I simplified it here) I was able to add custom populated content from a specific column (defined in a backend_layout) to be rendered inside a navigation panel.

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

how to make the current language unclickable?

My website has two languages, English and German.. I want to make the English text unclickable if i'm currently in the Enlgish verison, and same with the german?
How to do that i'm still new to typoscript?
Edit: I can't seem to find a way
this is my code :
20 = HMENU
20 {
special = language
special.value = 0,3
#,6,9
special.normalWhenNoLanguage = 0
wrap =
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
linkWrap = | |*| | |
stdWrap.override = EN || DE || NL || FR
doNotLinkIt = 1
stdWrap {
typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=3 || &L=6 || &L=9
addQueryString = 1
addQueryString.exclude = L,id,cHash,no_cache
addQueryString.method = GET
useCacheHash = 1
no_cache = 0
}
}
}
ACT < .NO
#ACT.linkWrap = ||
ACT.stdWrap.typolink.ATagParams = class="active"
USERDEF1 < .NO
USERDEF1 {
linkWrap = <span class="inactive">|</span> |*| <span class="inactive"> | |</span>
#linkWrap = <li class="text-muted">|</li>
stdWrap.typolink >
}
USERDEF2 < .USERDEF1
#USERDEF2 < .ACT
#USERDEF2 {
# linkWrap = |
# linkWrap = <li class="text-muted">|</li>
# stdWrap.typolink >
#}
}
}
}
here is a working TypoScript Example:
lib.language = COA
lib.language {
20 = HMENU
20 {
special = language
# List of language-IDs (0 = Default, 1 = englisch)
special.value = 0,1
1 = TMENU
1 {
wrap = <ul>|</ul>
NO = 1
NO {
stdWrap.cObject = TEXT
stdWrap.cObject {
value = DE || EN
# Menu in english
lang.en = DE || EN
}
allWrap = <li>|</li>
}
ACT < .NO
# this is the important Part!
ACT {
doNotLinkIt = 1
allWrap = <li class="acive">|</li>
}
# (if the Page isn't translated)
USERDEF1 < .NO
USERDEF1 {
doNotLinkIt = 1
allWrap = <li class="empty">|</li>
}
# Selected Language (if the Page isn't translated)
USERDEF2 < .NO
USERDEF2 {
doNotLinkIt = 1
allWrap = <li class="active empty">|</li>
}
}
}
}
The important part ist ACT.doNotLinkIt = 1.

Typolink content in menu?

I am trying to make a menu that displays the page's first content element header and image and have them be links. But the typolink part doesn't seem to work for me:
lib.menu = HMENU
lib.menu {
1 = TMENU
1.NO {
doNotLinkIt = 1
wrapItemAndSub = <div>|</div>
stdWrap.cObject = CONTENT
stdWrap.cObject {
table = tt_content
select {
pidInList.field = uid
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.typolink.parameter.field = uid
}
}
}
}
Just to add give the full working example. Using section.field = uid you can link to the content element itself.
lib.menu = HMENU
lib.menu {
1 = TMENU
1.NO {
doNotLinkIt = 1
wrapItemAndSub = <div>|</div>
stdWrap.cObject = CONTENT
stdWrap.cObject {
table = tt_content
select {
pidInList.field = uid
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.typolink {
parameter.field = pid
section.field = uid
}
}
}
}
}

TYPO3 6.2: Image-Slider with Hyperlink from Page Ressources

I did a well working Imageslider from the page ressources. Now I'm trying to hyperlink those Images with a Link also provided in the ressource. This is what I have so far:
TS:
lib.headerimage = COA_INT
lib.headerimage {
1 = COA
1 {
stdWrap.required = 1
stdWrap.outerWrap.cObject = TEXT
stdWrap.outerWrap.cObject.value = <li><img src=" | " /></li>
2 = IMG_RESOURCE
2 {
file {
import.data = levelmedia:-1, slide
import.listNum = 0
treatIdAsReference = 1
}
}
}
2 < .1
2.2.file.import.listNum = 1
3 < .1
3.2.file.import.listNum = 2
}
Layout:
<div class="headerimage">
<ul>
<f:render section="headerimage" />
</ul>
</div>
This Results in the expected HTML Output
<ul>
<li>
<img />
</li>
</ul>
But I want the following Output
<ul>
<li>
<a href="link_from_page_ressource">
<img />
</a>
</li>
</ul>
How do I get those Links around my Images?
Thanks in advance
UPDATE
Solution:
lib.headerimage = COA
lib.headerimage {
1 = FILES
1 {
references {
data = levelmedia:-1, slide
}
renderObj = COA
renderObj {
wrap = <li>|</li>
1 = IMAGE
1 {
file.import.data = file:current:publicUrl
altText.data = file:current:title
stdWrap.typolink.parameter.data = file:current:link
}
}
}
}
You shoul use FILES to handle this. Use something like (not tested!)
lib.headerimage = COA
lib.headerimage {
wrap = <ul>|</ul>
10 = FILES
10 {
references {
data = levelmedia:-1, slide
}
renderObj = COA
renderObj {
10 = IMAGE
10 {
file.import.data = file:current:publicUrl
altText.data = file:current:title
stdWrap.typolink.parameter.data = file:current:link
wrap = <li>|</li>
}
}
}
}
Can you try this?
lib.headerimage = COA
lib.headerimage {
wrap = <ul>|</ul>
1 = IMAGE
1 {
file {
import.data = levelmedia:-1, slide
import.listNum = 0
treatIdAsReference = 1
}
stdWrap.typolink.parameter.data = file:current:link
stdWrap.outerWrap = <ul>|</ul>
}
2 < .1
2.file.import.listNum = 1
3 < .1
3.file.import.listNum = 2
}
lib.randomImage = COA_INT
lib.randomImage.10 = FILES
lib.randomImage.10.sorting = rand()
lib.randomImage.10 {
references {
table = pages
data = levelmedia:-1, slide
treatIdAsReference = 1
}
maxItems= 1
renderObj = COA
renderObj {
10 = IMAGE
10 {
file {
import {
data = file:current:publicUrl
}
}
}
}
stdWrap {
wrap = |
}
}
Reference link: http://www.t3hut.com/blog/post/news/detail/News/random-image-from-page-resources-files-in-typo3-62.html
This ts works for me !

alt/title attributes in img-tag in typo3

I use the following Typoscript to get a menu of pages with images from respective page resource.
How can i get the page-title (or page-description etc.) to the images alt and/or title-tags?
tt_content.menu.20.4 >
tt_content.menu.20.4 = COA
tt_content.menu.20.4 {
wrap = <div>|</div>
10 = HMENU
10 {
special = directory
special.value.field = pages
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
stdWrap >
stdWrap {
cObject = COA
cObject {
10 = FILES
10 {
references {
table = pages
uid.data = field = uid
fieldName = media
data = levelmedia:-1, slide
treatIdAsReference = 1
listNum = 0
}
renderObj = IMG_RESOURCE
renderObj {
file.import.data = file:current:publicUrl
file.maxW = 100
file.maxH = 60
required = 1
}
stdWrap.wrap = <img src="|" title="???pagetitle???" alt="???pagetitle???">
}
}
}
wrapItemAndSub = <div>|</div>
}
}
}
}
Have you tried it with dataWrap?
i think it could be something like this
stdWrap.dataWrap = <img src="|" title="{field:title}" alt="{field:title}">
or maybe...
stdWrap.dataWrap = <img src="|" title="{page:title}" alt="{page:title}">
this works for me now
cObject = COA
cObject {
10 = FILES
10 {
references {
table = pages
uid.data = field = uid
fieldName = media
data = levelmedia:-1, slide
treatIdAsReference = 1
listNum = 0
}
renderObj = COA
renderObj {
10 = IMG_RESOURCE
10.stdWrap.wrap = <img src="|
10.file.import.data = file:current:publicUrl
20 = TEXT
20.stdWrap.wrap = " title="|
20.data = file:current:title
30 = TEXT
30.stdWrap.wrap = " alt="|" />
30.data = file:current:title
}
stdWrap.wrap = |
stdWrap.required = 1
}
}