我想稍微改变 filelinks 的布局。我还是TS初学者,所以请耐心等待。
以下是我需要输出的内容:
<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>
我在TypoScript中的初步方法是这样的:
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 = <a href="#" class="list__link">|</a>
}
tt_content.uploads.20.renderObj.30 >
使用这个TS它看起来就像我想要的那样,但当然文件的实际链接已经消失了(只用这个虚拟的a-Tag换行替换它)。
我还尝试将此代码块写入:
tt_content.uploads.20.renderObj.20.data
而不是默认
file:current:title // file:current:name
但随后元素完全缺失。
你可以帮助TS新手吗?如何获得我想要的布局,并将 a - 和 span -Tag链接到我上传的文件?
非常感谢您提前
答案 0 :(得分:6)
看看这个:
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
}
}
}