---
title: "Frontendausgabe, aber wie?"
url: "https://www.typo3.net/d/61387-frontendausgabe-aber-wie"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage","PHP","Templates & Layouts"]
created: "2007-04-22"
last_reply: "2007-04-23"
replies: 4
solved: false
page: 1
pages: 1
lang: "de"
---

# Frontendausgabe, aber wie?

Extensions › Entwicklung · 4 Antworten · gestartet 2007-04-22

## Eröffnungsbeitrag

**kruemelchen26** · 2007-04-22 · [Beitrag #1](https://www.typo3.net/d/61387-frontendausgabe-aber-wie/1)

Hallo Leute,

ich habe mir eine Extension geschrieben, bzw. bin noch dabei. Das Frontend funktioniert soweit mit der Ausgabe, nur die Form der Ausgabe gefällt mir nicht.

Die Ausgabe der Ergebnisse erfolgt untereinander.
Beispiel:

1 - Nominat
2 - Morph1
3 - Morph2
4 - Morph3

Nun möchte ich diese jedoch so haben, das ich 3 Ergebnisse nebeneinander und das es dann in einer neuen Zeile losgeht.

Beispiel:

1 - Nominat  2 - Morph1  2 - Morph2
4 - Morph3

rein in PHP wüsste ich wie es hinbekommen würde, aber hier bei meiner Extension leider nicht und wollte ich daher um ein paar Tipps bitten. Anbei mal noch die Funktion und das Template, es handelt sich dabei um die **2.** while Schleife.

Grüße Marko

```php
function displayAll() {
		
		# Get the parts out of the template
		$template = array();
		$template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
		$template['reptile'] = $this->cObj->getSubpart($template['total'],'###REPTILES###');
		$query_species = "SELECT * FROM tx_mhreptiles_species";
    $res_species = mysql(TYPO3_db,$query_species);
    while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_species)) {
    	
    	$content_reptile = '';
		 	$markerArray['###MARKER_SPECIES###'] = $row['species'];             
			$query_reptiles = "SELECT * FROM tx_mhreptiles_reptiles WHERE species=".$row['uid']." order by species,subspecies";
    	$res_reptiles = mysql(TYPO3_db,$query_reptiles);
    	
    	while ($row_reptiles = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_reptiles)) {
	      
	      $markerArray["###MARKER_SUBSPECIES###"] = $this->getFieldContent('subspecies',$row_reptiles['subspecies']);
	      $markerArray["###MARKER_REPTILES_NAME###"] = $row_reptiles['name'];
	      $markerArray["###MARKER_REPTILES_IMAGE###"] = $this->getFieldContent('image',$row_reptiles['image']);
	      $markerArray["###MARKER_REPTILES_PRICE_FEMALE###"] = $row_reptiles['pricefemale'];
	      $markerArray["###MARKER_REPTILES_PRICE_MALE###"] = $row_reptiles['pricemale'];
	      $content_reptile .= $this->cObj->substituteMarkerArrayCached($template['reptile'], $markerArray);
	    
	    }
	    
	    $subpartArray['###CONTENT###'] = $content_reptile; 
			$content .= $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $subpartArray, $wrappedSubpartContentArray);
			
		}
		
    return $content;
    
	}
```

```html
<!-- ###TEMPLATE### begin -->
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
	<td align="left"><font face="Tahoma, Verdana, Arial" style="font-size: 11pt; font-weight: bold;">###MARKER_SPECIES###</font></td>
</tr>
<tr>
	<td align="left">###MARKER_SUBSPECIES###</td>
</tr>
<!-- ###CONTENT### -->
	<!-- ###REPTILES### -->
		<tr>
			<td align="left" width="25%">
				<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr valign="top">
						<td align="center" colspan="2">###MARKER_REPTILES_NAME###</td>
					</tr>
					<tr valign="top">
						<td align="center" colspan="2">###MARKER_REPTILES_IMAGE###</td>
					</tr>
					<tr valign="top">
						<td align="left" width="50%">Preis Weibchen:</td>
						<td align="right" width="50%">###MARKER_REPTILES_PRICE_FEMALE###</td>
					</tr>
					<tr valign="top">
						<td align="left" width="50%">Preis Männchen:</td>
						<td align="right" width="50%">###MARKER_REPTILES_PRICE_MALE###</td>
					</tr>
				</table>
			</td>
		</tr>
	<!-- ###REPTILES### -->
<!-- ###CONTENT### -->
</table>
<!-- ###TEMPLATE### end -->
```

## Antworten

### [#2](https://www.typo3.net/d/61387-frontendausgabe-aber-wie/2) · just2b · 2007-04-23

Hallo Marko,

lass in der Schleife ne Variable bis 4 Zählen und schreib dann das in einen anderen subpart

```php
$content_reptile2 .= $this->cObj->substituteMarkerArrayCached($template['reptile2'], $markerArray);
```

, den du dann danach dranhängst...

nur mal eine Idee, vielleicht gings auch eleganter

georg

### [#3](https://www.typo3.net/d/61387-frontendausgabe-aber-wie/3) · kruemelchen26 · 2007-04-23

Hallo georg,

dann müsste ich aber mein Template um reptile2 erweitern oder nicht?
Das mit eine Variable hochzählen habe ich auch schon versucht jedoch nicht hinbekommen. Könntest Du mir da ggf. ein Bsp. zu nennen?

Grüße Marko

### [#4](https://www.typo3.net/d/61387-frontendausgabe-aber-wie/4) · jenses · 2007-04-23

> **kruemelchen26 schrieb:**
>
> ... rein in PHP wüsste ich wie es hinbekommen würde ...

> **kruemelchen26 schrieb:**
>
> Das mit eine Variable hochzählen habe ich auch schon versucht jedoch nicht hinbekommen. Könntest Du mir da ggf. ein Bsp. zu nennen?

Hmmh, ich sehe da irgendwie Widersprüche  8-)
[PHP für Dummies](http://www.php-dummies.de/)

### [#5](https://www.typo3.net/d/61387-frontendausgabe-aber-wie/5) · kruemelchen26 · 2007-04-23

hmm...habe nochmal dran gearbeitet und das mit der Variable eingefügt und jetzt läuft es. Keine Ahnung warum es gestern nicht ging.

```php
function displayAll() {
		
		# Get the parts out of the template
		$template = array();
		$template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
		$template['reptile'] = $this->cObj->getSubpart($template['total'],'###REPTILES###');
		$query_species = "SELECT * FROM tx_mhreptiles_species WHERE deleted='0' AND hidden='0'";
    $res_species = mysql(TYPO3_db,$query_species);
    while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_species)) {
    	
    	$content_reptile = '';
		 	$markerArray['###MARKER_SPECIES###'] = $row['species'];             
			$query_reptiles = "SELECT * FROM tx_mhreptiles_reptiles WHERE species=".$row['uid']." AND deleted='0' AND hidden='0' order by species,subspecies";
    	$res_reptiles = mysql(TYPO3_db,$query_reptiles);

    	while ($row_reptiles = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res_reptiles)) {
				if(!$i) { $markerArray["###MARKER_TR_START###"] = '<tr>'; }
				else { $markerArray["###MARKER_TR_START###"] = ''; }
				$i++;
				
	      $markerArray["###MARKER_SUBSPECIES###"] = $this->getFieldContent('subspecies',$row_reptiles['subspecies']);
	      $markerArray["###MARKER_REPTILES_NAME###"] = $row_reptiles['name'];
	      $markerArray["###MARKER_REPTILES_IMAGE###"] = $this->getFieldContent('image',$row_reptiles['image']);
	      $markerArray["###MARKER_REPTILES_PRICE_FEMALE###"] = $row_reptiles['pricefemale'];
	      $markerArray["###MARKER_REPTILES_PRICE_MALE###"] = $row_reptiles['pricemale'];
	      
	      if($i == 3) { $markerArray["###MARKER_TR_END###"] = '</tr>'; unset($i); }
	      else { $markerArray["###MARKER_TR_END###"] = ''; }
	      
	      $content_reptile .= $this->cObj->substituteMarkerArrayCached($template['reptile'], $markerArray);
	    
	    }
	    
	    $subpartArray['###CONTENT###'] = $content_reptile; 
			$content .= $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $subpartArray, $wrappedSubpartContentArray);
			
		}
		
    return $content;
    
	}
```

---

Quelle: „Frontendausgabe, aber wie?“, typo3.net, https://www.typo3.net/d/61387-frontendausgabe-aber-wie
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
