在 Typo3 (6.2.14) 中更改文件链接布局
Change filelinks layout in Typo3 (6.2.14)
我想稍微更改 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,它看起来就像我想要的那样,但是文件的实际 link 当然不见了(只是用这个虚拟的 a-Tag 包装代替它)。
我也试着把这个代码块写到:
tt_content.uploads.20.renderObj.20.data
而不是默认值
file:current:title // file:current:name
但是元素完全丢失了。
你能帮一个TS新手吗?我怎样才能获得我想要的布局,以及 link a- 和 span- 标记到我上传的文件?
非常感谢您
看看这个:
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 =
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
}
}
}
我想稍微更改 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,它看起来就像我想要的那样,但是文件的实际 link 当然不见了(只是用这个虚拟的 a-Tag 包装代替它)。
我也试着把这个代码块写到:
tt_content.uploads.20.renderObj.20.data
而不是默认值
file:current:title // file:current:name
但是元素完全丢失了。
你能帮一个TS新手吗?我怎样才能获得我想要的布局,以及 link a- 和 span- 标记到我上传的文件?
非常感谢您
看看这个:
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 =
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
}
}
}