[TYPO3-german] Hilfe bei "for" Schleife

Chris Wolff - AERTiCKET AG cwolff at aer.de
Thu Jan 16 17:04:08 CET 2014


Hi Gianluigi Martino

Du must statt echo einfach eine variable fülle und diese dann am ende mittels return zurück geben

z.b so:

<?php
   class user_klasse
   {
      function main()
      {
		$content = ''; // empty string
	 	$client = new SoapClient('http:..', array('trace' => 1));
		$result = $client->getGalleryPictures("..", "..", .., .., ..);
		$content .= '<ul>';
				for ($i = 0; $i <= count($result->item) - 1; $i++) {
					$bild = $result->item[$i]->smallpictureurl;
					$link = $result->item[$i]->url;
					$content .= '<li>';
						$content .= "<a href='$link' target='_blank'><img src='$bild' /></a>";
						$content .= "<br />";
						$content .= $result->item[$i]->name . ' / ' . $result->item[$i]->birthdayDate;
					$content .= '</li>';
				}
		$content .= '</ul>';
		Return $content;
      }
   }
?>

Gruss chris

-----Ursprüngliche Nachricht-----
Von: typo3-german-bounces at lists.typo3.org [mailto:typo3-german-bounces at lists.typo3.org] Im Auftrag von Gianluigi Martino
Gesendet: Donnerstag, 16. Januar 2014 16:51
An: typo3-german at lists.typo3.org
Betreff: [TYPO3-german] Hilfe bei "for" Schleife

hallo zusammen

möchte einem marker eine php ausgabe übergeben das php script funktioniert aber um den code einem marker zuzuweisen, muss ich bei der klasse die werte zurückgeben.

mein problem ist jetzt, wie muss ich die "for"-schleife bei der klasse einbauen um die werte zurückzugeben?

hier meine php:

<?php
   class user_klasse
   {
      function main()
      {
	 	$client = new SoapClient('http:..', array('trace' => 1));
		$result = $client->getGalleryPictures("..", "..", .., .., ..);
		echo '<ul>';
				for ($i = 0; $i <= count($result->item) - 1; $i++) {
					$bild = $result->item[$i]->smallpictureurl;
					$link = $result->item[$i]->url;
					echo '<li>';
						echo "<a href='$link' target='_blank'><img src='$bild' /></a>";
						echo "<br />";
						echo $result->item[$i]->name . ' / ' . $result->item[$i]->birthdayDate;
					echo '</li>';
				}
		echo '</ul>';
      }
   }
?>


und hier mein typoscript:

includeLibs.time = fileadmin/php/kinder.php

lib.babys= USER
lib.babys {
  userFunc = user_klasse->main
}
seite.10.marks.KINDER < lib.babys


vielen dank für eure hilfe
_______________________________________________
TYPO3-german mailing list
TYPO3-german at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german


More information about the TYPO3-german mailing list