Hallo,
ich möchte, dass Plugin A Plugin B aufruft:
$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
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:
$spContactObj = t3lib_div::makeInstance('tx_extspcontact_pi1');
$this->shSPContent = $spContactObj->main($content,$conf);
In Plugin B ist eingetragen:
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
Hi,
habe endlich eine Lösung gefunden. Beim instanzieren von Plugin B übergebe ich das Objekt von Plugin A:
$this->shSPContent = $spContactObj->main($this,$this->conf);
In Plugin B muss natürlich noch cObj extra geladen werden:
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();