[TYPO3-UG Freiburg] Bilder aus media in zufälliger Reihenfolge

Ben Robinson benjamecho at web.de
Sat Sep 24 13:56:21 CEST 2011


Klappt leider noch nicht.

Aktuelles Script:
-------------
page.10.subparts.FRONTISPIECE = TEXT
page.10.subparts.FRONTISPIECE{
  data = LEVELMEDIA:-1, slide
  postUserFunc = user_frontispiece
  postUserFunc.mainImg.maxW = 300
}

<?php
function user_frontispiece($content,$conf) {
  $newcontent = "";
  $path = "/uploads/media/";
  $images = explode(",", $content);
	
  $newcontent .= var_dump($conf);
	
  // Bilder in Zufallsreihenfolge bringen
  shuffle($images);

  // alle Dateinamen testweise ausgeben
  foreach($images as $image){
     $newcontent .= $image."<br />";
  }

  // erstes Bild darstellen
  $mainimg = $conf['mainImg'];
  $mainimg['file.'] = $path.$images[0];
  $newcontent .= $GLOBALS['TSFE']->cObj->IMAGE($mainimg);

  return $newcontent;
}
?>
-------------

var_dump sagt:
array(1) { ["mainImg."]=> array(1) { ["maxW"]=> string(3) "300" } }

Noch eine Idee?

Gruß
Ben




Am 24.09.2011 um 13:37 schrieb Nicolas de Haen:

> Stimmt, du hast $conf ja als Parameter zur Verfügung, also nicht $this->conf sondern einfach nur $conf.
> Gib den doch mal mit var_dump($conf) aus. Normal kannst du da Typoscript übergeben:
> Z.B.:
> 
> page.10.subparts.FRONTISPIECE{
>  data = LEVELMEDIA:-1, slide
>  postUserFunc = user_frontispiece
> 	
>  postUserFunc.mainImg{
> 	maxW = 300
>  }
> }
> 
> 
> dann in PHP:
> 
> $mainimg = $conf['mainImg'];
> $mainimg['file.'] = $path.$images[0];
> 
> 
> Gruß,
> Nico
> 
> 
> _______________________________________________
> TYPO3-UG-Freiburg mailing list
> TYPO3-UG-Freiburg at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-ug-freiburg



More information about the TYPO3-UG-Freiburg mailing list