I have an HMENU in Typo3, in the Pageproperties i have stored an image. How can i show the Image from the Pageproperties in ne Menu? I have no Idea, why the image is not displayed.
Typo3 6.2
lib.produkt_start = HMENU
lib.produkt_start {
special = directory
special.value = 3
wrap = |
1 = TMENU
1 {
expAll = 1
NO = 1
NO {
allWrap = <div class="patterns col4" id="page_{field:uid}">|</div>
allWrap.insertData = 1
ATagParams = id="uid{field:uid}"
ATagParams.insertData = 1
stdWrap.cObject >
stdWrap.cObject = COA
stdWrap.wrap = |
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia-1, slide
30.treatIdAsReference = 1
30.import.listNum = 0
30.wrap = <h5>|</h5>
}
}
ACT = 1
ACT < .NO
}
}
I tested your problem with TYPO3 6.1.7
First of all you have to correct you code a little:
[...]
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
30.wrap = <h5>|</h5>
}
[...]
Now it will be "working" but only if you actually set an image in media field of the parent page, then it will be renderd in all child pages, ignoring the fact that the child pages have an own image set - I would consider this as sort of a bug of TMENU or TMENUITEM, but I haven't realy testet it fully.
You will get a problem with entity encoding of the title as well so I would try this option:
stdWrap.wrap.cObject = COA
stdWrap.wrap.cObject {
10 = TEXT
10.value = <br><h2>|</h2>
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
}
Strange is that the following does not work either:
30.file.import.field = media
This makes my suspition of the wrong slide behaviour above being a bug even stronger.
Related
Wrap works, but need the spaces for better presentation, unfortunately it doesn't work with "noTrimWrap" :-(
I use Typo3 9.5.10
I hope someone can help me :-)
myTicker = CONTENT
myTicker {
wrap = |
table = tx_myPlugin_domain_model_tick
select {
pidInList = 31
max = 4
selectFields = dbfield_1, dbfield_2
}
renderObj = COA
renderObj {
10 = TEXT
10.field = dbfield_1
20 < .10
20.field = dbfield_2
noTrimWrap = |<div>+++ Neuer Eintrag: | +++</div>|
}
}
COA does not have a direct stdWrap on the root level. This should work though:
myTicker = CONTENT
myTicker {
wrap = |
table = tx_myPlugin_domain_model_tick
select {
pidInList = 31
max = 4
selectFields = dbfield_1, dbfield_2
}
renderObj = COA
renderObj {
10 = TEXT
10.field = dbfield_1
20 < .10
20.field = dbfield_2
stdWrap.noTrimWrap = |<div>+++ Neuer Eintrag: | +++</div>|
}
}
I am getting the text from the abstract field and splitting it by new line.
What I want is to wrap the first line in an H5 tag and all lines after in P tags.
This is what I have tried:
tt_content.menu.20.102 = HMENU
tt_content.menu.20.102 {
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap.cObject = COA
stdWrap.cObject {
50 = TEXT
50.stdWrap {
field = abstract
split {
token.char = 10
cObjNum = 1 || 2
1.current = 1
1.wrap = <h5>|</h5>
2.current = 1
2.wrap = <p>|</p>
}
}
}
}
}
}
But it wraps all the lines in H5... How do I make this work?
I found a bug report that mentions this issue here: https://forge.typo3.org/issues/59533
It seems the best workaround that I can see is to instead use listNum
This has the obvious drawback of only working with a limited number of paragraphs but at least it sort of works.
10 = TEXT
10.field = abstract
10.wrap = <h5>|</h5>
10.listNum = 0
10.listNum.splitChar = 10
20 < .10
20.wrap = <p>|</p>
20.listNum = 1
30 < .20
30.listNum = 2
Just a combination of both, the original code and the listNum workaround should do the job. Still have to find a way to get the rest of the first "split" into the second one. So consider this answer to be WIP please. We are still discussing it on our Coders.Care Twitch channel in the TYPO3 service station.
10 = TEXT
10.field = abstract
10.wrap = <h5>|</h5>
10.listNum = 0
10.listNum.splitChar = 10
20 < .10
20.listNum = 1
20.split {
token.char = 10
cObjNum = 1
1.current = 1
1.wrap = <p>|</p>
}
I am selecting categories on an English page. The categories have the language ID 0. English is ID 1.
But I need the same categories on both languages.
cheese = CONTENT
cheese {
wrap = <cheese_legend>|</cheese_legend>
table = sys_category
select {
pidInList = {$categories}
selectFields = *
where = deleted = 0
andWhere = sys_language_uid = 0
andWhere = hidden = 0
}
renderObj = COA
renderObj {
wrap = <cat>|</cat>
10 = TEXT
10 {
stdWrap.field = uid
stdWrap.wrap = <div>|</div>
}
20 = TEXT
20 {
stdWrap.field = title
stdWrap.wrap = <div>|</div>
}
30 = TEXT
30 {
stdWrap.field = sys_language_uid
stdWrap.wrap = <div>|</div>
}
}
}
So I'm explicitly selecting the sys_language_uid = 0!!
But nevertheless the script only gives me results with the ID = 1.
Any idea to make this baby work?
You have doubled the andWhere = statement, so the one below overwrites the one above.
Use andWhere = sys_language_uid = 0 AND hidden = 0 in one line.
For getting the english ones you use andWhere = sys_language_uid = 1 AND hidden = 0.
I've got a TYPO3 page with two languages the default one and english.
Now when I press the view button on the secondary language to get the prview page with the URL www.domain.de/home/?L=2. But the page is the german version and not the english one?
I'm using realurl could that be the problem?
Update Typoscript
#xhtml_cleaning = all damit wird mit "/" ausgegeben
uniqueLinkVars = 1
linkVars = L(1-3)
sys_language_uid = 0
sys_language_overlay = hideNonTranslated
sys_language_mode = content_fallback
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
intTarget = _self
extTarget = _blank
}
and this
CONTENTMAIN = CONTENT
CONTENTMAIN.table = tt_content
CONTENTMAIN.select.where = colPos = 0
CONTENTMAIN.select.languageField = sys_language_uid
CONTENTMAIN.select.orderBy = sorting
UPDATE:
actual full Typoscript (setup)
# Responsive Design Optimization
tt_content.image.20 {
imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap1"> | </div>
imageColumnStdWrap.dataWrap = <div class="csc-textpic-imagecolumn"> | </div>
}
tt_content.image.20 {
rendering {
dl {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
oneImageStdWrap.dataWrap = <dl class="csc-textpic-image###CLASSES###" > | </dl>
}
ul {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"><ul> | </ul></div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"><ul> | </ul></div>
oneImageStdWrap.dataWrap = <li class="csc-textpic-image###CLASSES###"> | </li>
}
div {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
oneImageStdWrap.dataWrap = <div class="csc-textpic-image###CLASSES###"> | </div>
}
simple {
imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap csc-textpic-single-image"> | </div>
}
}
}
tt_content.image.20 {
renderMethod = figure
rendering {
figure {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
noRowsStdWrap.wrap =
oneImageStdWrap.dataWrap = <figure class="csc-textpic-image"> | </figure>
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = <div> | </div>
caption.wrap = <figcaption> | </figcaption>
caption.required = 1
}
}
}
#CONFIGURATION####################
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
config {
# headerComment (
#Diese Seite wurde erstellt von:
#DeWo Werbeagentur OHG
#Zuständig für Layout-Umsetzung
#dewo.de
#)
doctype = html5
renderCharset = utf-8
metaCharset = utf-8
prefixLocalAnchors = all
simulateStaticDocuments = 0
tx_realurl_enable = 1
absRefPrefix = /
spamProtectEmailAddresses = 2
spamProtectEmailAddresses_atSubst = (at)
// Cache settings
cache_period = 43200
#Entfernt Kommentare um die content elements
disablePrefixComment = 1
index_enable = 1
removeDefaultJS = external
admPanel = 1
sendCacheHeaders = 1
#xhtml_cleaning = all damit wird mit "/" ausgegeben
uniqueLinkVars = 1
linkVars = L(1-3)
sys_language_uid = 0
sys_language_overlay = hideNonTranslated
sys_language_mode = content_fallback
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
intTarget = _self
extTarget = _blank
}
page = PAGE
page {
typeNum = 0
shortcutIcon = fileadmin/bilder/favicon.png
appletouchicon =
insertClassesFromRTE = 1
adminPanelStyles = 1
# The meta Tags for the page.
meta {
# Description - auslesen und ggf. vererben wenn kein entry auf single page
description.data = page:description
description.ifEmpty.data = levelfield :-1, description, slide
# Keywords - auslesen und ggf. vererben wenn kein entry auf single page
keywords.data = page:keywords
keywords.ifEmpty.data = levelfield :-1, keywords, slide
keywords.keywords = 1
date.data = page:SYS_LASTCHANGED // page:crdate;
date.date = Y-m-d
author =
publisher =
copyright =
PAGE-TOPIC = Information
PAGE-TYPE = Information
language.data = TSFE:lang
robots = index, follow
siteinfo = robots.txt
revisit-after = 7 days
viewport = width = device-width, initial-scale=1.0
}
includeJSlibs {
jquery = fileadmin/config/script/js/jquery-1.11.1.min.js
jquery.forceOnTop = 1
}
includeCSS {
#a standard Grid system based on the boilertemplate
boil = fileadmin/config/script/css/boilerplate.css
boil.media = screen
boil.forceOnTop = 1
# our own navigation stylesheet
mefish = fileadmin/config/script/css/megafish.css
mefish.media = only screen and (min-width: 768px)
mefish.forceOnTop = 0
# Grid file based on the boilertemplate
grid = fileadmin/config/script/css/grid.css
grid.media = screen
grid.forceOnTop = 0
# our own stylesheet
flex = fileadmin/config/script/css/flexslider_styles.css
flex.media = screen
flex.forceOnTop = 0
# icon font
awe = fileadmin/config/script/font-awesome-4.0.3/css/font-awesome.min.css
awe.media = screen
awe.forceOnTop = 0
# IndexSearch Template
indexSearch = fileadmin/customDesign/indexsearch/css/indexsearch-style.css
indexSearch.media = screen
indexSearch.forceOnTop = 0
}
}
# END Page object
# blendet Subnavi aus,
[globalVar = TSFE:page|layout = 1]
page.includeCSS {
subnav = fileadmin/config/script/css/subnavi.css
subnav.media = screen
subnav.forceOnTop = 0
}
[global]
)
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/config/script/template/template.html
page.20 {
workOnSubpart = DOCUMENT
marks {
#links
INHALTOBEN = CONTENT
INHALTOBEN.table = tt_content
INHALTOBEN.select.where = colPos = 1
INHALTOBEN.select.languageField = sys_language_uid
INHALTOBEN.select.orderBy = sorting
#normal
CONTENTMAIN = CONTENT
CONTENTMAIN.table = tt_content
CONTENTMAIN.select.where = colPos = 0
CONTENTMAIN.select.languageField = sys_language_uid
CONTENTMAIN.select.orderBy = sorting
#rechts
CONTENTASIDE = CONTENT
CONTENTASIDE.table = tt_content
CONTENTASIDE.select.where = colPos = 2
CONTENTASIDE.select.languageField = sys_language_uid
CONTENTASIDE.select.orderBy = sorting
#rand
OBEN = CONTENT
OBEN.table = tt_content
OBEN.select.where = colPos = 3
OBEN.select.languageField = sys_language_uid
OBEN.select.orderBy = sorting
#Hier in Zeile 220 die id von der Seite 'static' eingeben (Änderung 15.05.14 Florian Kasischke)
#NAVISTATIC = HMENU
#NAVISTATIC.special = directory
#NAVISTATIC.special.value =
#NAVISTATIC.excludeUidList = ,
#NAVISTATIC {
#1 = TMENU
#1 {
#expAll = 1
#wrap = <ul class="headernavmenu">|</ul>
#noBlur = 1
#NO = 1
#NO.ATagTitle.field = title
#NO.wrapItemAndSub = <li>|</li>
#NO.allWrap = | I |*| | I |*| |
#ACT < .NO
#ACT.ATagParams = class="active_static"
#}
#}
BREAD = HMENU
BREAD {
special = rootline
special.range = 0 | 2
1 = TMENU
1.NO.ATagTitle.field = title
1.NO.ATagParams = class="staticbread"
1.NO.allWrap = | / |*| | / |*| |
}
NAVIMAIN = HMENU
NAVIMAIN.entryLevel = 0
#NAVIMAIN.excludeUidList =
NAVIMAIN {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT.ATagParams = class="act"
ACT.wrapItemAndSub = <li> |</li>
}
2 = TMENU
2 {
expAll = 1
maxItems = 10
wrap = <div class="sf-mega">|</div>
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <div class="sf-mega-section">|</div>
stdWrap.wrap = |
ATagParams = class="headermega"
stdWrap.htmlSpecialChars = 1
doNotLinkIt = 0
}
}
3 = TMENU
3 {
expAll = 1
maxItems = 20
wrap = <ul>|</ul>
NO = 1
NO {
ATagTitle.field = title
linkWrap = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li>|</li>
ATagParams = class="active"
}
}
#4 < .3
}
NAVIOFF = HMENU
NAVIOFF.entryLevel = 0
#NAVIOFF.excludeUidList =
NAVIOFF {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB < .NO
IFSUB.ATagParams = class="pfeile"
ACT = 1
ACT < .NO
ACT.ATagParams = class="menuakt"
CUR = 1
CUR < .ACT
}
2 < .1
2.wrap = <ul>|</ul>
2.NO.wrapItemAndSub = <li class="first"> |</li> |*| <li> |</li> |*| <li class="last"> | </li>
2.ACT = 0
3 < .2
4 < .2
}
SUBNAVI = HMENU
SUBNAVI.entryLevel = 1
SUBNAVI.excludeUidList = 3,754,68
SUBNAVI {
1 = TMENU
1 {
expAll = 1
wrap = <ul>|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.ATagParams = style="border-bottom:2px solid rgba(255, 255, 255, 0.8);"
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB < .NO
#IFSUB.stdWrap.dataWrap=| ▾
#▾
#IFSUB.ATagParams = class="pfeile"
ACT < .NO
ACT.ATagParams = class="subactive"
#IFSUB = 1
# IFSUB.wrapItemAndSub = <li class="menuparent">|</li>
#ACTIFSUB < .IFSUB
# wenn unterseiten vorhanden, dann kann Icon angezeigt werden
# IFSUB = 1
# IFSUB.stdWrap.dataWrap=» |
}
2 < .1
2 {
expAll = 0
}
3 < .2
3 = TMENU
3 {
expAll = 1
NO.ATagParams = style="padding-left:1.5rem;font-size:0.875rem;"
ACT < .NO
ACT.ATagParams = class="subactive" style="padding-left:1.5rem;font-size:0.875rem;"
}
#4 < .3
}
}
}
## Localization menu:
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
5.offset = 2,2
}
1.ACT < lib.langMenu.1.NO
1.ACT=1
1.ACT.backColor = black
1.USERDEF1 < lib.langMenu.1.NO
1.USERDEF1=1
1.USERDEF1.5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
1.USERDEF1.noLink = 0
1.USERDEF2 < lib.langMenu.1.USERDEF1
1.USERDEF2.backColor = green
}
You need to include configuration that changes the language depending on the value of the L parameter:
config {
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
}
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
Repeat this for all the languages with the accordant language ID (uid of the language record).
EDIT: The conditional block should be below the default block for language 0; added that.
You have the condition for language switch at the top of your typoscript. Later you override the config.sys_language_uid with the default value of 0.
So you have to put your condition at the bottom of your typoscript.
So I have 2 list of string in 2 fields, altText and imagecaption. I have them wrapped in a div. I want to make the div not render if neither have content in some loop, on each iteration of the loop. How can I do it?
30 = COA
30{
wrap = <div class="case-info">|</div>
required = 1
30 = TEXT
30{
wrap = <div>|</div>
field = altText
listNum.splitChar = 10
listNum.stdWrap.data = register:SPLIT_COUNT
required = 1
}
40 < .30
40.field = imagecaption
}
The output of html is this:
<div class="case-info">
<div></div>
<div></div>
</div>
Remove the wrap and try it this way:
30 = COA
30{
stdWrap.required = 1
stdWrap.wrap = <div class="case-info">|</div>
30 = TEXT
30{
field = altText
listNum.splitChar = 10
listNum.stdWrap.data = register:SPLIT_COUNT
trim = 1
required = 1
wrap = <div>|</div>
}
40 < .30
40.field = imagecaption
}
so, the wrap will only executed, if there is content (required = 1)