---
title: "Aufruf Plugin zu Plugin"
url: "https://www.typo3.net/d/61663-aufruf-plugin-zu-plugin"
source: "typo3.net"
tags: ["Extensions","Entwicklung","Frage"]
created: "2007-04-26"
last_reply: "2007-04-28"
replies: 2
solved: false
page: 1
pages: 1
lang: "de"
---

# Aufruf Plugin zu Plugin

Extensions › Entwicklung · 2 Antworten · gestartet 2007-04-26

## Eröffnungsbeitrag

**metan** · 2007-04-26 · [Beitrag #1](https://www.typo3.net/d/61663-aufruf-plugin-zu-plugin/1)

Hallo,

ich möchte, dass Plugin A Plugin B aufruft:

```php
$spContactObj = t3lib_div::makeInstance('tx_extspcontact_pi1');
$this->shSPContent = $spContactObj->main(NULL,"SINGLEVIEW");
```

In Plugin B versuche ich nun (wie bereits in Plugin A) die normalen T3-Link-Methoden aufzurufen, jedoch erscheint:
Fatal error: Call to a member function getTypoLink_URL() on a non-object in

Was mache ich da falsch, Plugin B wird doch Instanziert?

Grüße
metan

## Antworten

### [#2](https://www.typo3.net/d/61663-aufruf-plugin-zu-plugin/2) · metan · 2007-04-27

Hi,

Wenn ein Plugin im FE aufgerufen wird, dann wird doch das aufgerufene Plugin instanziert, dadurch ist der Zugriff auf alle Methoden der tslib_pibase gewährleistet.

Wie erreicht man das nun, wenn Plugin A Plugin B aufruft.

In Plugin A ist eingetragen:

```php
$spContactObj = t3lib_div::makeInstance('tx_extspcontact_pi1');
$this->shSPContent = $spContactObj->main($content,$conf);
```

In Plugin B ist eingetragen:

```php
function main($content,$conf)	{
    // On the front end, we can use the provided template setup.
		$this->conf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();


		$content='<strong>This is a few paragraphs:</strong><br />
			<p>This is line 1</p>
			<p>This is line 2</p>

			<h3>This is a form:</h3>
			<form action="'.$this->pi_getPageLink($GLOBALS['TSFE']->id).'" method="POST">
				<input type="hidden" name="no_cache" value="1">
				<input type="text" name="'.$this->prefixId.'[input_field]" value="'.htmlspecialchars($this->piVars['input_field']).'">
				<input type="submit" name="'.$this->prefixId.'[submit_button]" value="'.htmlspecialchars($this->pi_getLL('submit_button_label')).'">
			</form>
			<br />
			<p>You can click here to '.$this->pi_linkToPage('get to this page again',$GLOBALS['TSFE']->id).'</p>
		';
	
		return $this->pi_wrapInBaseClass($content);
	}
```

Jedoch erscheint immer die Fehlermeldung:
Fatal error: Call to a member function getTypoLink_URL() on a non-object in D:\xampp\htdocs\newpage\typo3\sysext\cms\tslib\class.tslib_pibase.php on line 267

Wie kann man aus Plugin A Plugin so instanzieren, als wäre es direkt aus dem FE?

metan

### [#3](https://www.typo3.net/d/61663-aufruf-plugin-zu-plugin/3) · metan · 2007-04-28

Hi,

habe endlich eine Lösung gefunden. Beim instanzieren von Plugin B übergebe ich das  Objekt von Plugin A:

```php
$this->shSPContent = $spContactObj->main($this,$this->conf);
```

In Plugin B muss natürlich noch cObj extra geladen werden:

```php
function main($content,$conf)	{
    global $TSFE;

    $this->cObj = $TSFE->cObj;

    // On the front end, we can use the provided template setup.
		$this->conf = $TSFE->tmpl->setup['plugin.'][$this->prefixId.'.'];
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
```

---

Quelle: „Aufruf Plugin zu Plugin“, typo3.net, https://www.typo3.net/d/61663-aufruf-plugin-zu-plugin
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
