[TYPO3-german] Contentelement für Download-Dateien aus Verzeichnissen
Renzo Bauen
typo3 at conpassione.ch
Sat Sep 13 11:48:33 CEST 2014
Hei Jungs,
jetzt macht ihr aber aus einer Mücke einen Elefanten.
Das Ganze ist eine Core-Funktionalität und mit der Core-Extension
filelist problemlos möglich.
Die Filelist kann mit CSS frei gestyled werden und bietet eigentlich
alles was man haben muss. Einfach ein Plugin "Dateilinks" Platzieren,
die gewünschten Dateien auswählen und fertig ist das Ganze.
Wenn das nicht funktioniert, dann ist entweder im Template das
css_styled_content nicht geladen oder es gibt einen TS-Code, der das
Element abschiesst.
Man kann, wie gesagt das ganze sehr weitgehend beeinflussen. Ich habe
meine eigenen Fileicons in fileadmin/images/fileicons abgelegt und gebe
auch die Grössenbezeichnung vor.
Das ganze sieht dann aus wie hier:
http://www.tierklinik-thun.ch/wissen/merkblaetter/
Zur Konfiguration:
In den Constants:
styles.content.uploads.filesizeBytesLabels = " | kB| MB| GB"
styles.content.uploads.target = _blank
Im Setup:
tt_content.uploads >
tt_content.uploads = COA
tt_content.uploads {
10 < lib.stdheader
20 = FILES
20 {
# get from file references:
references {
table = tt_content
fieldName = media
}
collections.field = file_collections
# get from path (backwards compatibility, contains strings like
"fileadmin/user_uploads/")
folders.field = select_key
sorting.field = filelink_sorting
# render the files
renderObj = COA
renderObj {
# icon
10 = IMAGE
10 {
file.import = fileadmin/Images/fileicons/
file.import.data = file:current:extension
file.import.case = lower
file.import.wrap = |.gif
stdWrap.typolink {
parameter.data = file:current:originalUid //
file:current:uid
parameter.wrap = file:|
fileTarget < lib.parseTarget
fileTarget.override = {$styles.content.uploads.target}
fileTarget.override.override.field = target
removePrependedNumbers = 1
}
}
# description
20 = TEXT
20 {
data = file:{file:current:originalUid}:description
data.insertData = 1
#data = file:current:description
htmlSpecialChars = 1
wrap = <span class="csc-uploads-description">|</span>
required = 1
typolink < tt_content.uploads.20.renderObj.10.stdWrap.typolink
}
# filename
30 = TEXT
30 {
data = file:current:name
htmlSpecialChars = 1
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 <
tt_content.uploads.20.renderObj.10.stdWrap.typolink
wrap = <span class="csc-uploads-fileName">|</span>
}
# file size
40 = TEXT
40 {
#if.isTrue.field = filelink_size
data = file:current:size
wrap = - <span class="csc-uploads-fileSize">|</span>
bytes = 1
bytes.labels = {$styles.content.uploads.filesizeBytesLabels}
}
wrap = <li>|</li>
}
# wrap around whole content element with <ul> and editIcons
stdWrap {
editIcons = tt_content: media, layout [table_bgColor|
table_border|table_cellspacing|table_cellpadding], filelink_size
editIcons.iconTitle.data =
LLL:EXT:css_styled_content/pi1/locallang.xml:eIcon.filelist
prefixComment = 2 | Special File list:
dataWrap = <ul class="csc-uploads
csc-uploads-{field:layout}">|</ul>
}
}
wrap = <div class="filelinks">|</div>
}
Gruss Renzo
--
conPassione gmbh
CH-3661 Uetendorf
+41 33 345 00 92
More information about the TYPO3-german
mailing list