Dateilinks: Beschreibung statt Dateinamen anzeigen [Gelöst]


  • 0 x
    24. 01. 2006, 15:04

    Hallo Zusammen,

    kann mir jemand verraten wie ich in den Dateilinks die Beschreibung der Datei statt deren Dateiname anzeigen lasse.

    Ich bin am verzweifeln was das betrifft..
    Hab dazu schon was gefunden [url]http://www.plug-one.de/spielwiese-playgroun/typo-3/filelink-caption-bes/[/url]
    aber es scheint nicht zu funktionieren

    vielen dank für eure hilfe im vorraus

  • johanness johanness
    Jedi-Ratsmitglied
    0 x
    916 Beiträge
    0 Hilfreiche Beiträge
    24. 01. 2006, 16:50 - Lösung

    Geht das sicher nicht? Vertippt? Scheint gut überlegt veröfetnlicht geworden zu sein...

    Ich habe das für meine Seite auch mal gemacht, aber weiß nicht mehr genau wie. Ich glaube, ich habe die Datei "class.tx_cssstyledcontent_pi1.php" folgendermaßen umgeschrieben (paste & copy - vorher lieber mal ne Sicherungskopie machen!!):

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 2002-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
    6. * All rights reserved
    7. *
    8. * This script is part of the TYPO3 project. The TYPO3 project is
    9. * free software; you can redistribute it and/or modify
    10. * it under the terms of the GNU General Public License as published by
    11. * the Free Software Foundation; either version 2 of the License, or
    12. * (at your option) any later version.
    13. *
    14. * The GNU General Public License can be found at
    15. * http://www.gnu.org/copyleft/gpl.html.
    16. *
    17. * This script is distributed in the hope that it will be useful,
    18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20. * GNU General Public License for more details.
    21. *
    22. * This copyright notice MUST APPEAR in all copies of the script!
    23. ***************************************************************/
    24. /**
    25.  * Plugin 'Content rendering' for the 'css_styled_content' extension.
    26.  *
    27.  * $Id: class.tx_cssstyledcontent_pi1.php,v 1.7 2004/08/26 14:43:21 typo3 Exp $
    28.  *
    29.  * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
    30.  */
    31. /**
    32.  * [CLASS/FUNCTION INDEX of SCRIPT]
    33.  *
    34.  *
    35.  *
    36.  * 63: class tx_cssstyledcontent_pi1 extends tslib_pibase
    37.  *
    38.  * SECTION: Rendering of Content Elements:
    39.  * 91: function render_bullets($content,$conf)
    40.  * 130: function render_table($content,$conf)
    41.  * 191: function render_uploads($content,$conf)
    42.  *
    43.  * SECTION: Helper functions
    44.  * 313: function getTableAttributes($conf,$type)
    45.  *
    46.  * TOTAL FUNCTIONS: 4
    47.  * (This index is automatically created/updated by the extension "extdeveval")
    48.  *
    49.  */
    50.  
    51. require_once(PATH_tslib.'class.tslib_pibase.php');
    52.  
    53.  
    54.  
    55. /**
    56.  * Plugin class - instantiated from TypoScript.
    57.  * Rendering some content elements from tt_content table.
    58.  *
    59.  * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
    60.  * @package TYPO3
    61.  * @subpackage tx_cssstyledcontent
    62.  */
    63. class tx_cssstyledcontent_pi1 extends tslib_pibase {
    64.  
    65. // Default plugin variables:
    66. var $prefixId = 'tx_cssstyledcontent_pi1'; // Same as class name
    67. var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php'; // Path to this script relative to the extension dir.
    68. var $extKey = 'css_styled_content'; // The extension key.
    69. var $conf = array();
    70.  
    71.  
    72.  
    73.  
    74.  
    75.  
    76.  
    77. /***********************************
    78. *
    79. * Rendering of Content Elements:
    80. *
    81. ***********************************/
    82.  
    83. /**
    84. * Rendering the "Bulletlist" type content element, called from TypoScript (tt_content.bullets.20)
    85. *
    86. * @param string Content input. Not used, ignore.
    87. * @param array TypoScript configuration
    88. * @return string HTML output.
    89. * @access private
    90. */
    91. function render_bullets($content,$conf) {
    92.  
    93. // Get bodytext field content, returning blank if empty:
    94. $content = trim($this->cObj->data['bodytext']);
    95. if (!strcmp($content,'')) return '';
    96.  
    97. // Split into single lines:
    98. $lines = t3lib_div::trimExplode(chr(10),$content);
    99. while(list($k)=each($lines)) {
    100. $lines[$k]='
    101. <li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
    102. }
    103.  
    104. // Set header type:
    105. $type = intval($this->cObj->data['layout']);
    106.  
    107. // Compile list:
    108. $out = '
    109. <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
    110. implode('',$lines).'
    111. </ul>';
    112.  
    113. // Calling stdWrap:
    114. if ($conf['stdWrap.']) {
    115. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    116. }
    117.  
    118. // Return value
    119. return $out;
    120. }
    121.  
    122. /**
    123. * Rendering the "Table" type content element, called from TypoScript (tt_content.table.20)
    124. *
    125. * @param string Content input. Not used, ignore.
    126. * @param array TypoScript configuration
    127. * @return string HTML output.
    128. * @access private
    129. */
    130. function render_table($content,$conf) {
    131.  
    132. // Get bodytext field content
    133. $content = trim($this->cObj->data['bodytext']);
    134. if (!strcmp($content,'')) return '';
    135.  
    136. // Split into single lines (will become table-rows):
    137. $rows = t3lib_div::trimExplode(chr(10),$content);
    138.  
    139. // Find number of columns to render:
    140. $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode('|',current($rows))),0,100);
    141.  
    142. // Traverse rows (rendering the table here)
    143. $rCount = count($rows);
    144. foreach($rows as $k => $v) {
    145. $cells = explode('|',$v);
    146. $newCells=array();
    147. for($a=0;$a<$cols;$a++) {
    148. if (!strcmp(trim($cells[$a]),'')) $cells[$a]='&nbsp;';
    149. $cellAttribs = ($a>0 && ($cols-1)==$a) ? ' class="td-last"' : ' class="td-'.$a.'"';
    150. $newCells[$a] = '
    151. <td'.$cellAttribs.'><p>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</p></td>';
    152. }
    153.  
    154. $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
    155. $rowAttribs = ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
    156. $rows[$k]='
    157. <tr'.$rowAttribs.'>'.implode('',$newCells).'
    158. </tr>';
    159. }
    160.  
    161. // Set header type:
    162. $type = intval($this->cObj->data['layout']);
    163.  
    164. // Table tag params.
    165. $tableTagParams = $this->getTableAttributes($conf,$type);
    166. $tableTagParams['class'] = 'contenttable contenttable-'.$type;
    167.  
    168. // Compile table output:
    169. $out = '
    170. <table '.t3lib_div::implodeAttributes($tableTagParams).'>'. // Omitted xhtmlSafe argument TRUE - none of the values will be needed to be converted anyways, no need to spend processing time on that.
    171. implode('',$rows).'
    172. </table>';
    173.  
    174. // Calling stdWrap:
    175. if ($conf['stdWrap.']) {
    176. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    177. }
    178.  
    179. // Return value
    180. return $out;
    181. }
    182.  
    183. /**
    184. * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
    185. *
    186. * @param string Content input. Not used, ignore.
    187. * @param array TypoScript configuration
    188. * @return string HTML output.
    189. * @access private
    190. */
    191. function render_uploads($content,$conf) {
    192.  
    193. $out = '';
    194.  
    195. // Set layout type:
    196. $type = intval($this->cObj->data['layout']);
    197.  
    198. // Get the list of files (using stdWrap function since that is easiest)
    199. $lConf=array();
    200. $lConf['override.']['filelist.']['field'] = 'select_key';
    201. $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
    202.  
    203. // Explode into an array:
    204. $fileArray = t3lib_div::trimExplode(',',$fileList,1);
    205.  
    206. // If there were files to list...:
    207. if (count($fileArray)) {
    208.  
    209. // Get the path from which the images came:
    210. $selectKeyValues = explode('|',$this->cObj->data['select_key']);
    211. $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';
    212.  
    213. // Get the descriptions for the files (if any):
    214. $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);
    215.  
    216. // Adding hardcoded TS to linkProc configuration:
    217. $conf['linkProc.']['path.']['current'] = 1;
    218. $conf['linkProc.']['icon'] = 1; // Always render icon - is inserted by PHP if needed.
    219. $conf['linkProc.']['icon.']['wrap'] = ' | //**//'; // Temporary, internal split-token!
    220. $conf['linkProc.']['icon_link'] = 1; // ALways link the icon
    221. $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.
    222.  
    223. // Traverse the files found:
    224. $filesData = array();
    225. foreach($fileArray as $key => $fileName) {
    226. $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
    227. if (@is_file($absPath)) {
    228. $fI = pathinfo($fileName);
    229. $filesData[$key] = array();
    230.  
    231. $filesData[$key]['filename'] = $fileName;
    232. $filesData[$key]['path'] = $path;
    233. $filesData[$key]['filesize'] = filesize($absPath);
    234. $filesData[$key]['fileextension'] = strtolower($fI['extension']);
    235. $filesData[$key]['description'] = trim($descriptions[$key]);
    236.  
    237. $this->cObj->setCurrentVal($path);
    238. $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
    239. $filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.']));
    240. }
    241. }
    242.  
    243. // Now, lets render the list!
    244. $tRows = array();
    245. foreach($filesData as $key => $fileD) {
    246.  
    247. // Setting class of table row for odd/even rows:
    248. $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
    249.  
    250. // Render row, based on the "layout" setting
    251. $tRows[]='
    252. <tr>'.($type>0 ? '
    253. <td>
    254. '.$fileD['linkedFilenameParts'][0].'
    255. </td>' : '').'
    256. <td align="left">
    257. <a href="'.$path.$filesData[$key]['filename'].'" target=_blank">'.$filesData[$key]['description'].'</a>
    258. </td>'.($this->cObj->data['filelink_size'] ? '
    259. <td>
    260. &nbsp;&nbsp;&nbsp;&nbsp;'.t3lib_div::formatSize($fileD['filesize']).'
    261. </td>' : '').'
    262. </tr>
    263. <tr height="10"><td></td></tr>';
    264. }
    265.  
    266. // Table tag params.
    267. $tableTagParams = $this->getTableAttributes($conf,$type);
    268. $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
    269.  
    270.  
    271. // Compile it all into table tags:
    272. $out = '
    273. <table>
    274. '.implode('',$tRows).'
    275. </table>';
    276. }
    277.  
    278. // Calling stdWrap:
    279. if ($conf['stdWrap.']) {
    280. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    281. }
    282.  
    283. // Return value
    284. return $out;
    285. }
    286.  
    287.  
    288.  
    289.  
    290.  
    291.  
    292.  
    293.  
    294.  
    295.  
    296.  
    297.  
    298.  
    299. /************************************
    300. *
    301. * Helper functions
    302. *
    303. ************************************/
    304.  
    305. /**
    306. * Returns table attributes for uploads / tables.
    307. *
    308. * @param array TypoScript configuration array
    309. * @param integer The "layout" type
    310. * @return array Array with attributes inside.
    311. */
    312. function getTableAttributes($conf,$type) {
    313.  
    314. // Initializing:
    315. $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
    316.  
    317. $conf['color.'][200] = '';
    318. $conf['color.'][240] = 'black';
    319. $conf['color.'][241] = 'white';
    320. $conf['color.'][242] = '#333333';
    321. $conf['color.'][243] = 'gray';
    322. $conf['color.'][244] = 'silver';
    323.  
    324. // Create table attributes array:
    325. $tableTagParams = array();
    326. $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
    327. $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
    328. $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
    329. $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
    330.  
    331. // Return result:
    332. return $tableTagParams;
    333. }
    334. }
    335.  
    336.  
    337.  
    338. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) {
    339. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
    340. }
    341. ?>

    Dann sollte automatisch die Dateibeschreibung angezeigt werden... Aber die Dateinamen kann man dann nicht mehr anzeigen!


  • 1
  • johanness johanness
    Jedi-Ratsmitglied
    0 x
    916 Beiträge
    0 Hilfreiche Beiträge
    24. 01. 2006, 16:50

    Geht das sicher nicht? Vertippt? Scheint gut überlegt veröfetnlicht geworden zu sein...

    Ich habe das für meine Seite auch mal gemacht, aber weiß nicht mehr genau wie. Ich glaube, ich habe die Datei "class.tx_cssstyledcontent_pi1.php" folgendermaßen umgeschrieben (paste & copy - vorher lieber mal ne Sicherungskopie machen!!):

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 2002-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
    6. * All rights reserved
    7. *
    8. * This script is part of the TYPO3 project. The TYPO3 project is
    9. * free software; you can redistribute it and/or modify
    10. * it under the terms of the GNU General Public License as published by
    11. * the Free Software Foundation; either version 2 of the License, or
    12. * (at your option) any later version.
    13. *
    14. * The GNU General Public License can be found at
    15. * http://www.gnu.org/copyleft/gpl.html.
    16. *
    17. * This script is distributed in the hope that it will be useful,
    18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20. * GNU General Public License for more details.
    21. *
    22. * This copyright notice MUST APPEAR in all copies of the script!
    23. ***************************************************************/
    24. /**
    25.  * Plugin 'Content rendering' for the 'css_styled_content' extension.
    26.  *
    27.  * $Id: class.tx_cssstyledcontent_pi1.php,v 1.7 2004/08/26 14:43:21 typo3 Exp $
    28.  *
    29.  * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
    30.  */
    31. /**
    32.  * [CLASS/FUNCTION INDEX of SCRIPT]
    33.  *
    34.  *
    35.  *
    36.  * 63: class tx_cssstyledcontent_pi1 extends tslib_pibase
    37.  *
    38.  * SECTION: Rendering of Content Elements:
    39.  * 91: function render_bullets($content,$conf)
    40.  * 130: function render_table($content,$conf)
    41.  * 191: function render_uploads($content,$conf)
    42.  *
    43.  * SECTION: Helper functions
    44.  * 313: function getTableAttributes($conf,$type)
    45.  *
    46.  * TOTAL FUNCTIONS: 4
    47.  * (This index is automatically created/updated by the extension "extdeveval")
    48.  *
    49.  */
    50.  
    51. require_once(PATH_tslib.'class.tslib_pibase.php');
    52.  
    53.  
    54.  
    55. /**
    56.  * Plugin class - instantiated from TypoScript.
    57.  * Rendering some content elements from tt_content table.
    58.  *
    59.  * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
    60.  * @package TYPO3
    61.  * @subpackage tx_cssstyledcontent
    62.  */
    63. class tx_cssstyledcontent_pi1 extends tslib_pibase {
    64.  
    65. // Default plugin variables:
    66. var $prefixId = 'tx_cssstyledcontent_pi1'; // Same as class name
    67. var $scriptRelPath = 'pi1/class.tx_cssstyledcontent_pi1.php'; // Path to this script relative to the extension dir.
    68. var $extKey = 'css_styled_content'; // The extension key.
    69. var $conf = array();
    70.  
    71.  
    72.  
    73.  
    74.  
    75.  
    76.  
    77. /***********************************
    78. *
    79. * Rendering of Content Elements:
    80. *
    81. ***********************************/
    82.  
    83. /**
    84. * Rendering the "Bulletlist" type content element, called from TypoScript (tt_content.bullets.20)
    85. *
    86. * @param string Content input. Not used, ignore.
    87. * @param array TypoScript configuration
    88. * @return string HTML output.
    89. * @access private
    90. */
    91. function render_bullets($content,$conf) {
    92.  
    93. // Get bodytext field content, returning blank if empty:
    94. $content = trim($this->cObj->data['bodytext']);
    95. if (!strcmp($content,'')) return '';
    96.  
    97. // Split into single lines:
    98. $lines = t3lib_div::trimExplode(chr(10),$content);
    99. while(list($k)=each($lines)) {
    100. $lines[$k]='
    101. <li>'.$this->cObj->stdWrap($lines[$k],$conf['innerStdWrap.']).'</li>';
    102. }
    103.  
    104. // Set header type:
    105. $type = intval($this->cObj->data['layout']);
    106.  
    107. // Compile list:
    108. $out = '
    109. <ul class="csc-bulletlist csc-bulletlist-'.$type.'">'.
    110. implode('',$lines).'
    111. </ul>';
    112.  
    113. // Calling stdWrap:
    114. if ($conf['stdWrap.']) {
    115. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    116. }
    117.  
    118. // Return value
    119. return $out;
    120. }
    121.  
    122. /**
    123. * Rendering the "Table" type content element, called from TypoScript (tt_content.table.20)
    124. *
    125. * @param string Content input. Not used, ignore.
    126. * @param array TypoScript configuration
    127. * @return string HTML output.
    128. * @access private
    129. */
    130. function render_table($content,$conf) {
    131.  
    132. // Get bodytext field content
    133. $content = trim($this->cObj->data['bodytext']);
    134. if (!strcmp($content,'')) return '';
    135.  
    136. // Split into single lines (will become table-rows):
    137. $rows = t3lib_div::trimExplode(chr(10),$content);
    138.  
    139. // Find number of columns to render:
    140. $cols = t3lib_div::intInRange($this->cObj->data['cols']?$this->cObj->data['cols']:count(explode('|',current($rows))),0,100);
    141.  
    142. // Traverse rows (rendering the table here)
    143. $rCount = count($rows);
    144. foreach($rows as $k => $v) {
    145. $cells = explode('|',$v);
    146. $newCells=array();
    147. for($a=0;$a<$cols;$a++) {
    148. if (!strcmp(trim($cells[$a]),'')) $cells[$a]='&nbsp;';
    149. $cellAttribs = ($a>0 && ($cols-1)==$a) ? ' class="td-last"' : ' class="td-'.$a.'"';
    150. $newCells[$a] = '
    151. <td'.$cellAttribs.'><p>'.$this->cObj->stdWrap($cells[$a],$conf['innerStdWrap.']).'</p></td>';
    152. }
    153.  
    154. $oddEven = $k%2 ? 'tr-odd' : 'tr-even';
    155. $rowAttribs = ($k>0 && ($rCount-1)==$k) ? ' class="'.$oddEven.' tr-last"' : ' class="'.$oddEven.' tr-'.$k.'"';
    156. $rows[$k]='
    157. <tr'.$rowAttribs.'>'.implode('',$newCells).'
    158. </tr>';
    159. }
    160.  
    161. // Set header type:
    162. $type = intval($this->cObj->data['layout']);
    163.  
    164. // Table tag params.
    165. $tableTagParams = $this->getTableAttributes($conf,$type);
    166. $tableTagParams['class'] = 'contenttable contenttable-'.$type;
    167.  
    168. // Compile table output:
    169. $out = '
    170. <table '.t3lib_div::implodeAttributes($tableTagParams).'>'. // Omitted xhtmlSafe argument TRUE - none of the values will be needed to be converted anyways, no need to spend processing time on that.
    171. implode('',$rows).'
    172. </table>';
    173.  
    174. // Calling stdWrap:
    175. if ($conf['stdWrap.']) {
    176. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    177. }
    178.  
    179. // Return value
    180. return $out;
    181. }
    182.  
    183. /**
    184. * Rendering the "Filelinks" type content element, called from TypoScript (tt_content.uploads.20)
    185. *
    186. * @param string Content input. Not used, ignore.
    187. * @param array TypoScript configuration
    188. * @return string HTML output.
    189. * @access private
    190. */
    191. function render_uploads($content,$conf) {
    192.  
    193. $out = '';
    194.  
    195. // Set layout type:
    196. $type = intval($this->cObj->data['layout']);
    197.  
    198. // Get the list of files (using stdWrap function since that is easiest)
    199. $lConf=array();
    200. $lConf['override.']['filelist.']['field'] = 'select_key';
    201. $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
    202.  
    203. // Explode into an array:
    204. $fileArray = t3lib_div::trimExplode(',',$fileList,1);
    205.  
    206. // If there were files to list...:
    207. if (count($fileArray)) {
    208.  
    209. // Get the path from which the images came:
    210. $selectKeyValues = explode('|',$this->cObj->data['select_key']);
    211. $path = trim($selectKeyValues[0]) ? trim($selectKeyValues[0]) : 'uploads/media/';
    212.  
    213. // Get the descriptions for the files (if any):
    214. $descriptions = t3lib_div::trimExplode(chr(10),$this->cObj->data['imagecaption']);
    215.  
    216. // Adding hardcoded TS to linkProc configuration:
    217. $conf['linkProc.']['path.']['current'] = 1;
    218. $conf['linkProc.']['icon'] = 1; // Always render icon - is inserted by PHP if needed.
    219. $conf['linkProc.']['icon.']['wrap'] = ' | //**//'; // Temporary, internal split-token!
    220. $conf['linkProc.']['icon_link'] = 1; // ALways link the icon
    221. $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.
    222.  
    223. // Traverse the files found:
    224. $filesData = array();
    225. foreach($fileArray as $key => $fileName) {
    226. $absPath = t3lib_div::getFileAbsFileName($path.$fileName);
    227. if (@is_file($absPath)) {
    228. $fI = pathinfo($fileName);
    229. $filesData[$key] = array();
    230.  
    231. $filesData[$key]['filename'] = $fileName;
    232. $filesData[$key]['path'] = $path;
    233. $filesData[$key]['filesize'] = filesize($absPath);
    234. $filesData[$key]['fileextension'] = strtolower($fI['extension']);
    235. $filesData[$key]['description'] = trim($descriptions[$key]);
    236.  
    237. $this->cObj->setCurrentVal($path);
    238. $GLOBALS['TSFE']->register['ICON_REL_PATH'] = $path.$fileName;
    239. $filesData[$key]['linkedFilenameParts'] = explode('//**//',$this->cObj->filelink($fileName, $conf['linkProc.']));
    240. }
    241. }
    242.  
    243. // Now, lets render the list!
    244. $tRows = array();
    245. foreach($filesData as $key => $fileD) {
    246.  
    247. // Setting class of table row for odd/even rows:
    248. $oddEven = $key%2 ? 'tr-odd' : 'tr-even';
    249.  
    250. // Render row, based on the "layout" setting
    251. $tRows[]='
    252. <tr>'.($type>0 ? '
    253. <td>
    254. '.$fileD['linkedFilenameParts'][0].'
    255. </td>' : '').'
    256. <td align="left">
    257. <a href="'.$path.$filesData[$key]['filename'].'" target=_blank">'.$filesData[$key]['description'].'</a>
    258. </td>'.($this->cObj->data['filelink_size'] ? '
    259. <td>
    260. &nbsp;&nbsp;&nbsp;&nbsp;'.t3lib_div::formatSize($fileD['filesize']).'
    261. </td>' : '').'
    262. </tr>
    263. <tr height="10"><td></td></tr>';
    264. }
    265.  
    266. // Table tag params.
    267. $tableTagParams = $this->getTableAttributes($conf,$type);
    268. $tableTagParams['class'] = 'csc-uploads csc-uploads-'.$type;
    269.  
    270.  
    271. // Compile it all into table tags:
    272. $out = '
    273. <table>
    274. '.implode('',$tRows).'
    275. </table>';
    276. }
    277.  
    278. // Calling stdWrap:
    279. if ($conf['stdWrap.']) {
    280. $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
    281. }
    282.  
    283. // Return value
    284. return $out;
    285. }
    286.  
    287.  
    288.  
    289.  
    290.  
    291.  
    292.  
    293.  
    294.  
    295.  
    296.  
    297.  
    298.  
    299. /************************************
    300. *
    301. * Helper functions
    302. *
    303. ************************************/
    304.  
    305. /**
    306. * Returns table attributes for uploads / tables.
    307. *
    308. * @param array TypoScript configuration array
    309. * @param integer The "layout" type
    310. * @return array Array with attributes inside.
    311. */
    312. function getTableAttributes($conf,$type) {
    313.  
    314. // Initializing:
    315. $tableTagParams_conf = $conf['tableParams_'.$type.'.'];
    316.  
    317. $conf['color.'][200] = '';
    318. $conf['color.'][240] = 'black';
    319. $conf['color.'][241] = 'white';
    320. $conf['color.'][242] = '#333333';
    321. $conf['color.'][243] = 'gray';
    322. $conf['color.'][244] = 'silver';
    323.  
    324. // Create table attributes array:
    325. $tableTagParams = array();
    326. $tableTagParams['border'] = $this->cObj->data['table_border'] ? intval($this->cObj->data['table_border']) : $tableTagParams_conf['border'];
    327. $tableTagParams['cellspacing'] = $this->cObj->data['table_cellspacing'] ? intval($this->cObj->data['table_cellspacing']) : $tableTagParams_conf['cellspacing'];
    328. $tableTagParams['cellpadding'] = $this->cObj->data['table_cellpadding'] ? intval($this->cObj->data['table_cellpadding']) : $tableTagParams_conf['cellpadding'];
    329. $tableTagParams['bgcolor'] = isset($conf['color.'][$this->cObj->data['table_bgColor']]) ? $conf['color.'][$this->cObj->data['table_bgColor']] : $conf['color.']['default'];
    330.  
    331. // Return result:
    332. return $tableTagParams;
    333. }
    334. }
    335.  
    336.  
    337.  
    338. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']) {
    339. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php']);
    340. }
    341. ?>

    Dann sollte automatisch die Dateibeschreibung angezeigt werden... Aber die Dateinamen kann man dann nicht mehr anzeigen!


  • 0 x
    25. 01. 2006, 00:51

    danke.. ich werde es am donnerstag ausprobieren

  • 1