---
title: "Problem mit HTML-Markern und Subpart bzw. Wrapped-Subpart"
url: "https://www.typo3.net/d/104581-problem-mit-html-markern-und-subpart-bzw-wrapped-subpart"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage","Templates & Layouts"]
created: "2011-03-23"
last_reply: "2011-03-23"
replies: 0
solved: false
page: 1
pages: 1
lang: "de"
---

# Problem mit HTML-Markern und Subpart bzw. Wrapped-Subpart

Extensions › Entwicklung · 0 Antworten · gestartet 2011-03-23

## Eröffnungsbeitrag

**sefer** · 2011-03-23 · [Beitrag #1](https://www.typo3.net/d/104581-problem-mit-html-markern-und-subpart-bzw-wrapped-subpart/1)

Hi,

habe wieder einmal problem mit den Markern.

Ich möchte zwei Tabellen nebeneinander erstellen, die jeweils eine Liste von Spielern haben.
Also auf der Linken Seite die Heimspieler und auf der rechten Seite die Gast-Spieler.

So wie ich das mache, werden alle Marker im Subpart CONTENT_HOME bzw CONTENT_GUEST immer mit allen Spielern beider Mannschaften befüllt.
Hier
[www.Amafu.de -->Marker problem](http://85.214.98.37/index.php?id=56&cfc_league_fe%5BmatchId%5D=1722&cHash=cac029a32a)
kann man das sehen. Nur der Oberste Spieler (Markus) ist Heim, der Rest ist die Gastmannschaft!
Also müsste in der oberen Tabelle ein Spieler sein und in der unteren die restlichen.

Bin für jeden Hinweis dankbar.
Sefer

Meine Funktion:

```php
function game_all_ratings($url_rows){
		$base = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Base');
		$base->init($this); // $this ist hier das lokale Objekt, also das Plugin	
					
		$teams = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Teams');
		$teams->init($this); // $this ist hier das lokale Objekt, also das Plugin						
		
		$games = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Games');
		$games->init($this); // $this ist hier das lokale Objekt, also das Plugin	
					
		$saisons = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Saison');
		$saisons->init($this); // $this ist hier das lokale Objekt, also das Plugin	
									
		$teamnotes = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_TeamNotes');
		$teamnotes->init($this); // $this ist hier das lokale Objekt, also das Plugin	
																		
		$groups = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Group');
		$groups->init($this); // $this ist hier das lokale Objekt, also das Plugin	
										
		$competitions = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Competition');
		$competitions->init($this); // $this ist hier das lokale Objekt, also das Plugin	
										
		$profiles = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Profiles');
		$profiles->init($this); // $this ist hier das lokale Objekt, also das Plugin	
											
		$feusers = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_FeUsers');
		$feusers->init($this); // $this ist hier das lokale Objekt, also das Plugin	
				
		$rating = tx_div::makeInstance('tx_sdt3sportsfeadmin_util_Rating');
		$rating->init($this); // $this ist hier das lokale Objekt, also das Plugin	

		
		//t3lib_div::debug($rows_games, '$$$$rows_games');		
	   // configure the typolink
	 $this->plugin->local_cObj = t3lib_div::makeInstance('tslib_cObj');
	 $this->plugin->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
	 $this->plugin->typolink_conf = $this->plugin->conf['typolink.'];
	 $this->plugin->typolink_conf['parameter.']['current'] = 1;
	 	
	  	 // configure typolink
	 $temp_conf = $this->plugin->typolink_conf;
	 $temp_conf['useCacheHash']=$this->plugin->allowCaching;                            
	 $temp_conf['no_cache']=!$this->plugin->allowCaching;
	 $temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;	
	 	
		 // Get the parts out of the template
	 $template['game_all_ratings'] = $this->plugin->cObj->getSubpart($this->templateCode,'###RATINGVIEW_GAME_ALL_RATINGS###');
	 $template['content_home'] = $this->plugin->cObj->getSubpart($template['game_all_ratings'],'###CONTENT_HOME###');
	 $template['content_guest'] = $this->plugin->cObj->getSubpart($template['game_all_ratings'],'###CONTENT_GUEST###');
	 $template['item_home'] = $this->plugin->cObj->getSubpart($template['content_home'],'###ITEM_HOME###');
	 $template['item_guest'] = $this->plugin->cObj->getSubpart($template['content_guest'],'###ITEM_GUEST###');

 
	//1.) ermittlung der match_ID	
	$key=$base->my_array_search('cfc_league_fe[matchId]', $url_rows);
	if ($key){
		$array=explode("=",$url_rows[$key]);
		$game=$array[1]; //Alles nach Gleichheitszeichen!!!
	}else{
		$content='<br>Bitte ein Spiel auswählen';
		return $content;
	}	

	

		 	$arrayAll = array( 'team','saison', 'competition', 'round', 'average_rating','game','best_player_game', 'best_player','average_rating_team','best_player_team','switch');
	 	
		 	//2.2.1)Die Daten werden ermittelt
		 	//2.2.1.1)Ermittle Alle Stamm-und Ersatzspieler für die Heim/Auswärtsmannschaft!
		 	$select='uid, home, guest, players_home, substitutes_home, players_guest, substitutes_guest'; //round, home, guest, match_no, competition, round, 
		 	$where='uid='.$game;
		 	//$groupBy='`round`';
			$arr = array(
						'where'=>$where,
						//'groupby'=>$groupBy,
			            //'orderby' => 'round ASC, uid ASC',
			            );		
			$rows_games= tx_rnbase_util_DB::doSelect($select, 'tx_cfcleague_games', $arr, 0);


			//t3lib_div::debug($rows_games, '$$$$rows_games');

			//FOR ermittelt, ob die Spieler der Heimmannschaft oder der Gastmannschaft angezeigt werden sollen
$array_home_guest[] = "home";
$array_home_guest[] = "guest";
for ($a=0; $a<sizeof($array_home_guest); $a++){
	$home_guest=$array_home_guest[$a];

	//Spieler im Team 

		$rows_players=explode(",",$rows_games[0]['players_'.$home_guest]);
		$team=$rows_games[0][$home_guest];
		$team_name=$teams->getName($rows_games[0][$home_guest]);
	
	


	//Nur Anzeigen, wenn auch Spieler vorhanden sind!
	if($rows_players[0]){

			$arrayAll = array( 'picture', 'picture_'.$home_guest, 'player_'.$home_guest,'average_rating_player_'.$home_guest, 'player', 'average_rating_player', 'team_'.$home_guest, 'link_profiles', 'link_home', 'link_guest', 'link_best_player_team','rang','best_game', 'best_player_team','switch');
			$count_players=sizeof($rows_players);
			
			for ($r=0; $r<$count_players; $r++){
				//Aus diesem Spieltag, wird das Spiel mit dem besten Spieler ermittelt
				//if ($rows_rating){
					$row_color++;
					//$rang=$row_color;
					$switch=$row_color % 2 ;
	 			//DEFINITIONEN

				$player=$profiles->getLastName($rows_players[$r]).', '.$profiles->getFirstName($rows_players[$r]);
				$average_rating_player=$rating->getAveragePlayerGame($game,$rows_players[$r]);
				//$best_player_team=$teams->getName($team);
				
			
					 foreach ($arrayAll as $marker) {			 			  
				   		if ($marker=="link_profiles"){
				   			 // Fill wrapped subpart marker
					  		 $profile_pid=$GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->plugin->prefixId.'.']['cfc_league_fe.']['profile_pid'];
							 $temp_conf['additionalParams']= 'id='.$profile_pid.'&'.$this->plugin->prefixId.'[profile]='.$rows_players[$r];
							 $wrappedSubpartContentArray['###LINK_PROFILES###'] = $this->plugin->local_cObj->typolinkWrap($temp_conf);
							 $wrappedSubpartContentArray['###LINK_PROFILES###'][0]=str_replace ( 'id='.$GLOBALS["TSFE"]->id, $temp_conf['additionalParams'], $wrappedSubpartContentArray['###LINK_PROFILES###'][0] );
				   		
				   		}elseif($marker=="picture_".$home_guest){
				   			//Bild aus team-notes
							$where='player='.$rows_players[$r].' AND type=3 AND mediatype=0 AND comment IS NOT NULL';
						 	$arr = array(
						 				'where'=>$where,
										'orderby'=>'tstamp DESC',
					                    );		
							$rows_team_notes= tx_rnbase_util_DB::doSelect('*', 'tx_cfcleague_team_notes', $arr, 0);
							$path_to_picture=$rows_team_notes[0]['comment'];
							
							
							//Falls nicht in Team-Notes dann aus FE_USERS
							if (!$rows_team_notes){	
								$path_to_picture=$feusers->getImage($profiles->getFeusersId($rows_players[$r]));		
								$folder = $this->plugin->conf['folder.']['path_uploads_profile'];
								$path_to_picture=$folder.$path_to_picture;			
							}
							$maxW='';
				   			$maxH='18px';
							$width='';
				   			$height='800';
							$image_source = $path_to_picture;	
							$image=$base->create_image_properties($image_source,$maxW, $maxH, $width, $height);
											
				   			$markerArray['###'.strtoupper($marker).'###'] = $image;
				   			//<img width="150" height="113" border="0" title="" alt="" src="typo3temp/pics/3758d555b6.jpg"/>					
				   		
				   		}elseif($marker=="player_".$home_guest){				   			
				   			$markerArray['###'.strtoupper($marker).'###'] = $player;		   				   									 			
					 	
				   		}elseif($marker=="average_rating_player_".$home_guest){				   			
				   			$markerArray['###'.strtoupper($marker).'###'] = $average_rating_player;//'<td style="font-weight:bold;">'.$average_rating_best_player.'</td>';		   				   									 			   				   									 			
					 	
				   								 	
				   		}elseif($marker=="team_".$home_guest){				   			
				   			$markerArray['###'.strtoupper($marker).'###'] = $home_guest;		   				   									 			   				   									 			
					 	
				   			
				   		}elseif($marker=="switch"){				   			
				   			$markerArray['###'.strtoupper($marker).'###'] = $switch;		   				   									 			
					 	
				   		}//if-elseif END
					 }//foreach END				
				// add subpart into a string 
				// every second row has his own color -->see in template.html	
				if ($home_guest=="home"){			  
					$content_item .= $this->plugin->cObj->substituteMarkerArrayCached($template["item_home"], $markerArray,'', $wrappedSubpartContentArray);
					echo '<br>home'.$r;
				}else{
					$content_item .= $this->plugin->cObj->substituteMarkerArrayCached($template["item_guest"], $markerArray,'', $wrappedSubpartContentArray);
					echo '<br>guest'.$r;
				}
				//}//if END			
	 		}//FOR END	
	}// IF END
}//FOR END

	 		
	 	if ($row_color){
 			 foreach ($arrayAll as $marker) {	
			 	//DIE HEADER werden gesetzt
			 	//siehe in pi1/locallang.xml			 			  
				$markerArray['###HEADER_'.strtoupper($marker).'###'] = $this->plugin->pi_getLL('listFieldHeader_'.$marker,'MARKER-Übersetzungsfehler');
 			}//foreach END
	 	}else{
	 		$content='<b>Für dieses Spiel, wurden bisher keine Bewertungen abgegeben!</b>';
	 		return $content;
	 	}//if END	
 			
				// Fill subpart marker
				$subpartArray['###CONTENT_HOME###'] = $content_item;  
				$subpartArray['###CONTENT_GUEST###'] = $content_item;
				//Finalize and create the content by replacing the marker in the template 		
				$content = $this->plugin->cObj->substituteMarkerArrayCached($template['game_all_ratings'], $markerArray, $subpartArray,  $wrappedSubpartContentArray);

	 return $content;
}//function END
```

```typoscript
 <!-- ###RATINGVIEW_GAME_ALL_RATINGS### begin -->

<table border="1" class="tx_sdt3sportsfeadmin_pi1_klasse_table" border="0" cellpadding="1" style="text-align: left; " >
	<thead>
		<tr>
		<th>###HEADER_PICTURE###</th><th>###HEADER_PLAYER###</th><th> ###HEADER_AVERAGE_RATING_PLAYER### </th><th> TEAM </th>
		</tr>
	</thead>

   <!-- ###CONTENT_HOME### -->
    <!-- ###ITEM_HOME### -->
     <tr  style="text-align: center;" class="tx_sdt3sportsfeadmin_pi1_klasse_table_row###SWITCH###">
	<td> ###PICTURE_HOME###</td><td style="text-align: left;"><!--###LINK_PROFILES###-->###PLAYER_HOME###<!--###LINK_PROFILES###--></td><td  style="font-weight:bold;"> ###AVERAGE_RATING_PLAYER_HOME### </td>	<td> ###TEAM_HOME###</td>
     </tr>
    <!-- ###ITEM_HOME### -->
   <!-- ###CONTENT_HOME### -->
</table>


<table border="1" class="tx_sdt3sportsfeadmin_pi1_klasse_table" border="0" cellpadding="1" style="text-align: left; " >
	<thead>
		<tr>
		<th>###HEADER_PICTURE###</th><th>###HEADER_PLAYER###</th><th> ###HEADER_AVERAGE_RATING_PLAYER### </th><th> TEAM </th>
		</tr>
	</thead>

   <!-- ###CONTENT_GUEST### -->
    <!-- ###ITEM_GUEST### -->
     <tr  style="text-align: center;" class="tx_sdt3sportsfeadmin_pi1_klasse_table_row###SWITCH###">
	<td> ###PICTURE_GUEST###</td><td style="text-align: left;"><!--###LINK_PROFILES###-->###PLAYER_GUEST###<!--###LINK_PROFILES###--></td><td  style="font-weight:bold;"> ###AVERAGE_RATING_PLAYER_GUEST### </td>	<td> ###TEAM_GUEST###</td>
     </tr>
    <!-- ###ITEM_GUEST### -->
   <!-- ###CONTENT_GUEST### -->
</table>
<!-- ###RATINGVIEW_GAME_ALL_RATINGS### begin -->
```

---

Quelle: „Problem mit HTML-Markern und Subpart bzw. Wrapped-Subpart“, typo3.net, https://www.typo3.net/d/104581-problem-mit-html-markern-und-subpart-bzw-wrapped-subpart
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
