---
title: "typolink (wrap) in Klassen mit Template funktioniert nicht."
url: "https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage","Links"]
created: "2007-07-25"
last_reply: "2007-07-25"
replies: 3
solved: false
page: 1
pages: 1
lang: "de"
---

# typolink (wrap) in Klassen mit Template funktioniert nicht.

Extensions › Entwicklung · 3 Antworten · gestartet 2007-07-25

## Eröffnungsbeitrag

**Winddancer** · 2007-07-25 · [Beitrag #1](https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht/1)

Hi all,

ich bin scheinbar zu doof und bekomme es nicht zum laufen.

Ich habe eine Extension, welche auf ein Template zugreift. Ein Teil der Marker soll verlinkt werden (ähnlich wie bei tt_news).

Hier mein Template:

```typoscript
<!-- ###LISTVIEW### begin -->
###MODE_SELECTOR### <div class="ensemble_body">###pi_list_Prequel###
  <!-- ###CONTENT### -->
   <!-- ###ITEM### -->
    <!--###LINK_ITEM###-->###VORNAME### ###NACHNAME###<!--###LINK_ITEM###--> 
   <!-- ###ITEM### -->
  <!-- ###CONTENT### -->
 </div>
<!-- ###LISTVIEW### end -->
```

Ganz simpel.

Jetzt möchte ich, dass Vorname und Nachname verlinkt wird, aber ich bekomme es einfach nicht hin, dass der Link erstellt wird. :/

Hier mein Quelltext:

```php
function makelist($res)	{
		$items=array();
	
	
		# Get the template
	$this->templateCode = $this->cObj->fileResource($this->conf['templateFile']);
	 
	# Get the parts out of the template
	$template['total'] = $this->cObj->getSubpart($this->templateCode,'###LISTVIEW###');
	$template['item'] = $this->cObj->getSubpart($template['total'],'###ITEM###');
	
	// Create and fill items 
	while ($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		 
		// Content
		$markerArray['###VORNAME###'] = $this->getFieldContent('vorname');             
		$markerArray['###NACHNAME###'] = $this->getFieldContent('nachname'); 
		
		// Preconfigure the typolink
		$this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
		$this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
		$this->typolink_conf = $this->conf['typolink.'];
		$this->typolink_conf['parameter.']['current'] = 1;
		 
		// Typolink
		$temp_conf = $this->typolink_conf;
		$temp_conf["additionalParams"].= '&tx_myextension_pi1[mode]=list&tx_myextension_pi1[cat]='.$row['uid'];
		$temp_conf['useCacheHash']=$this->allowCaching;                            
		$temp_conf['no_cache']=!$this->allowCaching;
		$temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
		$wrappedSubpartContentArray['###LINK###'] = $this->local_cObj->typolinkWrap($temp_conf);

		$content_item .= $this->cObj->substituteMarkerArrayCached($template['item'], $markerArray, $wrappedSubpartContentArray);
		
	}   
	
	// Fill complete list into Template
	$subpartArray['###CONTENT###'] = $content_item; 
	
	$subpartArray['###MODE_SELECTOR###'] = $this->pi_list_modeSelector($items); // Mode Selector
	$subpartArray['###SEARCHBOX###'] = $this->pi_list_searchBox(); // Search box
	$subpartArray['###BROWSERESULTS###'] = $this->pi_list_browseresults(); // Result Browser
	
	$content = $this->cObj->substituteMarkerArrayCached($template['total'], array(), $subpartArray);
	
	return $content;		
	}
```

Kann mir jemand sagen was ich falsch mache?

## Antworten

### [#2](https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht/2) · ohrlab · 2007-07-25

auf den esten Blick verstehe ich nicht ganz wieso du ###LINK_ITEM### im Template hast.
Der Marker wird ja im Script gar nicht ersetzt, ist das bewusst so oder sollte etwa ###LINK### statt ###LINK_ITEM### stehen?

Du könntest ja die Marker ###VORNAME### & ###NACHNAME### auch gleich mit $this->pi_linkToPage(xy) o.ä ersetzen...

lg

### [#3](https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht/3) · Winddancer · 2007-07-25

Hallo Ohrlab,

jap sorry, war noch ein Typo, weil ich zwischenzeitlich eine andere Lösung getestet hatte. Natürlich sollten die Marker auch übereinstimmen. Aber auch dann tut sich nichts.

Klar kann ich das so machen wie in Kasper's Beispiel Extension (CD Library), aber ich wollte es eben so nett machen wie tt_news und das was ich verlinke voll und ganz dem Template überlassen.

:/

Als Beispiel für meine Quelltext diente dieser Guide. Allerdings wird dort nur generell ein Link am Ende ersetzt und nicht ein Link über jedes Item gelegt:
<http://wiki.typo3.org/index.php/Extension_Development,_using_HTML-Templates>.

[/url]

### [#4](https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht/4) · Winddancer · 2007-07-25

so einfach kanns manchmal sein. Habe mir die Funktion substituteMarkerArrayCached nochmal genau angesehen und ich hätte schlichtweg das Ergebnis des typolinkwrap an die letzte Stelle packen müssen. Denn das ist ein Array und besteht aus dem eigentlich Link Tag <a... und dem Link End Tag </a>.

Also hier nochmal der korrekte Code:

```php
	// Preconfigure the typolink
	$this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
	$this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
	$this->typolink_conf = $this->conf['typolink.'];
	$this->typolink_conf['parameter.']['current'] = 1;
	
	// Create and fill items 
	while ($this->internal['currentRow'] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		 
		// Content
		$markerArray['###VORNAME###'] = $this->getFieldContent('vorname');             
		$markerArray['###NACHNAME###'] = $this->getFieldContent('nachname'); 
		
		// Typolink
		$temp_conf = $this->typolink_conf;
		$temp_conf["additionalParams"].= '&tx_myextension_pi1[mode]=detail&tx_myextension_pi1[cat]='.$this->getFieldContent('uid');
		$temp_conf['useCacheHash']=$this->allowCaching;                            
		$temp_conf['no_cache']=!$this->allowCaching;
		$temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
		$wrappedSubpartContentArray['###LINK_ITEM###'] = $this->local_cObj->typolinkWrap($temp_conf);

		$content_item .= $this->cObj->substituteMarkerArrayCached($template['item'], $markerArray, array(), $wrappedSubpartContentArray);
		
	}
```

---

Quelle: „typolink (wrap) in Klassen mit Template funktioniert nicht.“, typo3.net, https://www.typo3.net/d/65807-typolink-wrap-in-klassen-mit-template-funktioniert-nicht
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
