Zum Inhalt springen

Filelink Layout ändern

Erstellt am 4. Juli 2005 · 11 Antworten · letzte Antwort am 25. Juli 2006

Tags: Frage

sortho ·

Ok, es liegt am CSS_styled_content mit dem default(content) kann man es ohne Probleme ändern. Jetzt hab ich aber schon alles auf das CSS aufgebaut, gibt es eine andere Möglichkeit das Layout zu verändern.

Danke.

hevty ·

könntest du vielleicht mal mitteilen, wie du das genau realisiert hast mit dem downloadbereich

kann man dort auch files hochladen oder nur downloaden

sortho schrieb:
Ich hab einen Downloadbereich, mit dem Filelink realisiert.

was für ein filelink, ist das ne extension??

gruß hevty

sortho ·

Filelink ist das Teil, dass Du ganz normal über eine Seite über <Neues Inhaltselement> < Dateiverweise> einfügen kannst (also wie ein Text halt auch) - das Ding heißt nur in TypoScript filelink, wenn Du entsprechende Änderungen am Aussehen vornehmen willst, also z.B.

tt_content.uploads.20.1.split.1.filelink.size.bytes.labels =  Byte| KB| MB| GB

Ändert die unschöne Bezeichnung der Größe der Datei in diese.

Das Ding ist nur zum Download da und ist schon standartmäßig vorhanden, Du musst also nichts dazu installieren. Für den Upload brauchst Du allerdings ne Extension.

Zu meinem Problem - das CSS_styled_page_content (das ist ne Extension) verträgt sich nicht mit dem filelink - schein bekannt zu sein, hab jetzt schon ein paar Beiträge (wenn auch nicht sehr hilfreiche) gefunden.

Meine Lösung für diese spezielle Seite eine neues Template mit default(content) anlegen und die Sache damit realisieren - nicht schön aber es geht wenigstens. Außer es hat jemand noch nen guten Tipp?

LineMan ·

hi...

also die dazugehörige stelle in der datei "pi1/class.tx_cssstyledcontent_pi1.php" ist folgende:

entweder änderst du das direkt dort... oder aber... so glaube ich kannst du das mit typoscript auch lösen.... habs aber noch nicht probiert.

tt_content.uploads.20.cObj.stdWrap = <div>|</div> (was erstmal "na klar" falsch ist)

/**
	 * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
	 *
	 * @param	string		Content input. Not used, ignore.
	 * @param	array		TypoScript configuration
	 * @return	string		HTML output.
	 * @access private
	 */
	function render_uploads($content,$conf)	{

			// Look for hook before running default code for function
		if ($hookObj = &$this->hookRequest('render_uploads'))	{
			return $hookObj->render_uploads($content,$conf);
		} else {

			$out = '';

				// Set layout type:
			$type = intval($this->cObj->data['layout']);

				// Get the list of files (using stdWrap function since that is easiest)
			$lConf=array();
			$lConf['override.']['filelist.']['field'] = 'select_key';
			$fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);

				// Explode into an array:
			$fileArray = t3lib_div::trimExplode(',',$fileList,1);

				// If there were files to list...:
			if (count($fileArray))	{

					// Get the path from which the images came:
				$selectKeyValues = explode('|',$this->cObj->data['select_key']);
				$path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';

					// Get the descriptions for the files (if any):
				$descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);

					// Adding hardcoded TS to linkProc configuration:
				$conf['linkProc.']['path.']['current'] = 1;
				$conf['linkProc.']['icon'] = 1;	// Always render icon - is inserted by PHP if needed.
				$conf['linkProc.']['icon.']['wrap'] = ' | //**//';	// Temporary, internal split-token!
				$conf['linkProc.']['icon_link'] = 1;	// ALways link the icon
				$conf['linkProc.']['icon_image_ext_list'] = ($type==2 || $type==3) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : '';	// If the layout is type 2 or 3 we will render an image based icon if possible.

					// Traverse the files found:
				$filesData = array();
				foreach($fileArray as $key => $fileName)	{
					$absPath = t3lib_div::getFileAbsFileName($path.$fileName);
					if (@is_file($absPath))	{
						$fI = pathinfo($fileName);
						$filesData[$key] = array();

						$filesData[$key]['filename'] = $fileName;
						$filesData[$key]['path'] = $path;
						$filesData[$key]['filesize'] = filesize($absPath);
						$filesData[$key]['fileextension'] = strtolower($fI['extension']);
						$filesData[$key]['description'] = trim($descriptions[$key]);

						$this->cObj->setCurrentVal($path);
						$GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
						$filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.']));
					}
				}

					// Now, lets render the list!
				$tRows = array();
				foreach($filesData as $key => $fileD)	{

						// Setting class of table row for odd/even rows:
					$oddEven = $key%2 ? 'tr-odd' : 'tr-even';

						// Render row, based on the "layout" setting
					$tRows[]='
					<tr class="'.$oddEven.'">'.($type>0 ? '
						<td class="csc-uploads-icon">
							'.$fileD['linkedFilenameParts'][0].'
						</td>' : '').'
						<td class="csc-uploads-fileName">
							<p>'.$fileD['linkedFilenameParts'][1].'</p>'.
							($fileD['description'] ? '
							<p class="csc-uploads-description">'.htmlspecialchars($fileD['description']).'</p>' : '').'
						</td>'.($this->cObj->data['filelink_size'] ? '
						<td class="csc-uploads-fileSize">
							<p>'.t3lib_div::formatSize($fileD['filesize']).'</p>
						</td>' : '').'
					</tr>';
				}

					// Table tag params.
				$tableTagParams = $this->getTableAttributes($conf,$type);
				$tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;


					// Compile it all into table tags:
				$out = '
				<table t3lib_div::implodeattributestabletagparams="">
					'.implode('',$tRows).'
				</table>';
			}

				// Calling stdWrap:
			if ($conf['stdWrap.']) {
				$out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
			}

				// Return value
			return $out;
sortho ·

Ok, vielen Dank. Hab ich mir fast gedacht, dass das quasi hardcodiert ist. Per Typoscript hab ich es nicht hinbekommen - aber über die Änderung der Tags an der Stelle geht es ja dann auch - super. 😃

LineMan ·

Ich habs jetzt auch so gemacht:

In der "pi1/class.tx_cssstyledcontent_pi1.php" habe ich diesen code ersetzt:

// Setting class of table row for odd/even rows:
$oddEven = $key%2 ? 'tr-odd' : 'tr-even';
// Render row, based on the "layout" setting
$tRows[]='<div class="'.$oddEven.' left">'.($type>0 ? '<div class="csc-uploads-icon left">'.$fileD['linkedFilenameParts'[0].'</div>' : '').'

<div class="csc-uploads-fileName left"><p>'.$fileD['linkedFilenameParts'][1].'</p>'.($fileD['description'] ? '<p class="csc-uploads-description left">'.htmlspecialchars($fileD['description']).'</p>' : '').'</div>'.($this->cObj->data['filelink_size'] ? '

<div class="csc-uploads-fileSize left"><p>'.t3lib_div::formatSize($fileD['filesize']).'</p></div>' : '').'</div>';}

und dann habe ich das css angepasst...

/************************/
/* Filelinks, generally */
/************************/
.left {float:left;}
.clear {clear:both;}
.csc-uploads { border: 0px; background-color : transparent; font-size: 0.8em; vertical-align : top;}
.csc-uploads .tr-even { background-color: #EFEFEF; }
.csc-uploads .tr-odd { background-color: #CCCCCC; }
.csc-uploads .csc-uploads-icon { padding-left: 6px; padding-right: 6px; width: 1%; text-align: center; vertical-align: middle; }
.csc-uploads .csc-uploads-fileName { width: 80%; padding-left: 0.3125em; }
.csc-uploads .csc-uploads-fileName P A { font-weight: bold; }
.csc-uploads .csc-uploads-fileName P.csc-uploads-description { font-style: italic; }
.csc-uploads .csc-uploads-fileSize { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
.csc-uploads-1 div { border-color: #186900; }
.csc-uploads-2 div { border-color: #10007B; }
.csc-uploads-3 div { border-color: #8A0020; }
.csc-uploads-3 { vertical-align: middle; }
.csc-uploads-3 .tr-even .csc-uploads-icon IMG { border: 0.125em solid #333333; }
.csc-uploads-3 .tr-odd .csc-uploads-icon IMG { border: 0.125em solid #333333; }
.csc-header-n2 h1 {color:#990000;margin:0px;padding:0px;margin-top:0.5em;}
konkret ·

Wer css_styled_content verwendet, kann die Labels des Filelink Content Element auch in der Datei:
class.t3lib_div.php im Ordner t3lib/
ändern.

in der Zeile 953 befindet sich die Funktion:

<?php 
function formatSize($sizeInBytes,$labels='')
?>

hier einfach in Zeile 957 die Variable

<?php
$labels = '| K| M| G';
?>

nach eigenen Wünschen abwandeln.

mfg alfred

konkret ·

Ich kenne diese Extension nicht, aber das wäre durchaus denkbar.
War ja nur ein Vorschlag, bin sicher es gibt da noch andere Möglichkeiten.

Für mich ist es halt nur wichtig nicht für jede kleine Änderung eine eigene Extension installieren zu müssen, wenn es mit dem Grundsystem und ein paar Handgriffen auch geht.

Aber da hat wohl jeder seine eigene Philosophie.

mfg konkret

Unbekannter Benutzer ·

es ist grundsätzlich immer besser, Änderungen am core in extensions auszulagern dann kann bei künftigen updates nichts vergessen werden.

Ich stimme nur bei einigen Extension Deiner Meinung zu, da werden ja zum Teil extensions gebaut deren Funktion man mit 5 Zeile TypoScript auch hinbekommt (z.B. für metatags eine bekannte Extension), da weiss ich wirklich nicht wozu das gut sein soll.

Viele Grüße
Niki