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
}
Related
I use the following Typoscript for a special menu. Of course there is no linkWrap right now if ATagTitle.dataWrap is empty. What is the best way to have as content of the ATagTitle.dataWrap if {field:title} is empty so that the linkWrap is used?
[treeLevel = 3,4,5]
lib.navHorizon = COA
lib.navHorizon {
stdWrap.wrap = <nav class="row nav_horizontal">|</nav>
10 = HMENU
10 {
special = browse
special {
items = prev
}
1 = TMENU
1.noBlur = 1
1.NO {
ATagTitle.dataWrap = {field:title}
linkWrap = <div class="d-none d-md-block col-4 nav_prev"><i class="fa fa-angle-double-left"></i> |</div>
}
}
25 = HMENU
25 {
special = browse
special {
items = up
}
1 = TMENU
1.noBlur = 1
1.NO {
ATagTitle.dataWrap = {field:title}
linkWrap = <div class="d-none d-md-block col-4 nav_up">|</div>
}
}
20 = HMENU
20 {
special = browse
special {
items = next
}
1 = TMENU
1.noBlur = 1
1.NO {
ATagTitle.dataWrap = {field:title}
linkWrap = <div class="d-none d-md-block col-4 order-3 nav_next">| <i class="fa fa-angle-double-right"></i></div>
}
}
}
[global]
Extended explanation:
I have a row with three columns. If the first column containing the link to the previous page is empty, the HTML for the column is also missing, so the layout is no longer correct.
From your additional information I understand the problem is not that the title is empty, but that there's no page at all. So if there's not previous page, it will not "execute" lib.navHorizon.10.1 at all.
You can fix this by not setting the wrap on the link, but on the HMENU:
10 = HMENU
10 {
special = browse
special {
items = prev
}
wrap = <div class="d-none d-md-block col-4 nav_prev"><i class="fa fa-angle-double-left"></i> |</div>
1 = TMENU
1.noBlur = 1
1.NO {
ATagTitle.dataWrap = {field:title}
}
}
This will ensure the wrap is always rendered, even if there's no page.
as (nearly) each object in typoscript has stdWrap functionality you can 'wrap' the dataWrap:
ATagTitle.dataWrap = {field:title}
ATagTitle.dataWrap.ifEmpty =
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
}
I want to change the layout of the filelinks a little bit. I'm still a TS beginner, so please bear with me.
Here is what I need to have as output:
<ul class="list__download">
<li>
<a href="/#" class="list__link">Preisblatt A
<span class="list__info">2.3 MB / PDF</span>
</a>
</li>
<li>
<a href="/#" class="list__link">Preisblatt B
<span class="list__info">2.3 MB / PDF</span>
</a>
</li>
<li>
<a href="/#" class="list__link">Preisblatt C
<span class="list__info">689 GB / SFV</span>
</a>
</li>
</ul>
My initial approach in the TypoScript was like this:
tt_content.uploads.10.10.1.dataWrap = <h2>|</h2>
tt_content.uploads.20.stdWrap.dataWrap = <ul class="list__download">|</ul>
tt_content.uploads.20.renderObj.wrap.cObject.10.oddEvenClass >
tt_content.uploads.20.renderObj.wrap.cObject.10.elementClass >
tt_content.uploads.20.renderObj.wrap.cObject.20.value = <li>|</li>
tt_content.uploads.20.renderObj.20 = COA
tt_content.uploads.20.renderObj.20 {
10 = TEXT
10 {
data = file:current:title
wrap = |
}
15 < linebreak
20 = TEXT
20 {
data = file:current:description
wrap = <span class="list__info">|</span>
}
wrap = |
}
tt_content.uploads.20.renderObj.30 >
With this TS it looks exactly the way I want it to be, but of course the actual link to the file is gone (only replaced it with this dummy a-Tag wrap).
I also tried to write this code block to:
tt_content.uploads.20.renderObj.20.data
instead of the default
file:current:title // file:current:name
but then the elements are completely missing.
Can you help a TS-newbie out? How can I achieve to get my desired layout, and link a- and span-Tag to my uploaded file?
Thank you very much in advance
check out this one :
tt_content.uploads.20 {
renderObj {
10 >
15 >
20 >
20 = TEXT
20 {
data = file:current:size // file:current:name
bytes = 1
bytes.labels = ” B| KB| MB| GB”
htmlSpecialChars = 1
outerWrap = <li>|</li>
innerWrap = {file:current:name}<span class="fileDesc"> |   / {file:current:extension}</span>
required = 1
replacement {
# equivalent to former useSpacesInLinkText = 0; remove using > to disable it
10 {
search = _
replace.char = 32
}
# equivalent to former stripFileExtensionFromLinkText = 0; move "_20" to "20" to enable it. Disabled by default.
_20 {
search = /(.*)(\..*)/
replace = \1
useRegExp = 1
}
}
typolink {
parameter.data = file:current:originalUid // file:current:uid
parameter.wrap = file:|
fileTarget < lib.parseTarget
fileTarget =
fileTarget.override = {$styles.content.uploads.target}
fileTarget.override.override.field = target
removePrependedNumbers = 1
ATagParams = class = "list__link"
title {
data = file:current:title
htmlSpecialChars = 1
}
}
#wrap = <span>|</span>
}
20.innerWrap.insertData = 1
20.innerWrap2.insertData = 1
20.wrap.insertData = 1
30 >
wrap.cObject {
10 = LOAD_REGISTER
10 {
oddEvenClass = odd li-first |*| even || odd
elementClass = {file:current:extension}
elementClass.insertData = 1
}
20 = TEXT
20 {
value = <tr class="{register:oddEvenClass} {register:elementClass}">|</tr>
insertData = 1
}
30 = RESTORE_REGISTER
}
}
}
I have a problem with marking a link in a Stiemap with dateUntil. Here is my typoscript:
tt_content.menu.20.1 >
tt_content.menu.20.1 < tt_content.menu.20.7
tt_content.menu.20.1.1.wrap = <div class="menu_list_sitemap">|</div>
tt_content.menu.20.1.1.NO {
ATagBeforeWrap = 0
doNotLinkIt = 1
stdWrap.htmlSpecialChars = 0
stdWrap.cObject = COA
stdWrap.cObject {
# Untertitel verlinken
10 = TEXT
10 {
field = subtitle
wrap = |
stdWrap.cObject = COA
stdWrap.cObject {
20 = IMAGE
20.file.import.field = media
20.file.import = uploads/media/
20.file.import.listNum = 0
20.wrap = |
30 = TEXT
30.field = title
30.wrap = <div class="txt">|</div>
40 = TEXT
40.if.isPositive.dataWrap = {field:newUntil}-{date:U}
40.wrap = <div class="txt2">|</div>
40.value = NEW
}
typolink.parameter.field = uid
}
}
}
The result is, that the new entries will get an additional div-container with class="txt2". Wokrs fine so far. :-) Here the generated HTML:
<li>
<a href="link-to-my-page">
<img width="22" height="22" alt="" src="my-image.png">
<div class="txt">My-Text</div>
<div class="txt2">NEW</div>
</a>
</li>
But now I need to add a "class='new'" to the Link or optional to a surrounding div-container (not my idea, really). I tried now for some hours to find a solution, but nothing worked.
Any suggestions?
i guess ATagParams would do the job. Use if to add only if needed
tt_content.menu.20.1 >
tt_content.menu.20.1 < tt_content.menu.20.7
tt_content.menu.20.1.1.wrap = <div class="menu_list_sitemap">|</div>
tt_content.menu.20.1.1.NO {
ATagBeforeWrap = 0
doNotLinkIt = 1
stdWrap.htmlSpecialChars = 0
stdWrap.cObject = COA
stdWrap.cObject {
# Untertitel verlinken
10 = TEXT
10 {
field = subtitle
wrap = |
### snip ###
typolink.parameter.field = uid
typolink.ATagParams = class="new"
typolink.ATagParams.if.isPositive.dataWrap = {field:newUntil}-{date:U}
}
}
}
I want to create a typolink from the current page but with other name and some additional GET parameter. E.g.
My custom name
This is my code which only prints out a text with MyCustomName.
lib.tsfooter >
lib.tsfooter = COA
lib.tsfooter {
10 = TEXT
10.value (
<!-- some HTML code-->
)
20 = TEXT
20.value = MyCustomName
20.stdWrap.typolink {
data = TSFE:id
addQueryString = 1
addQueryString.method = get
additionalParams = &myCustomParameter=1
}
}
What I'm doing wrong?
lib.tsfooter >
lib.tsfooter = COA
lib.tsfooter {
10 = TEXT
10.value (
<!-- some HTML code-->
)
20 = TEXT
20.value = MyCustomName
# you do not need "stdWrap" as pgampe mentioned, but it will work even with stdWrap
20.stdWrap.typolink {
# parameter was missing
parameter.data = TSFE:id
addQueryString = 1
addQueryString.method = get
additionalParams = &myCustomParameter=1
}
}