[TYPO3-german] ANLEITUNG: TypoScript abrufen aus der EXTENSION/mod1/index.php

Fabian Koenig koenig at bluhouse.de
Fri May 11 17:22:24 CEST 2007


Hier is nun die Anleitung.

==START==
Alles was hier an Script kommt, muss in die EXTENSIONORDNER/mod1/index.php
==ENDE==



VOR "class tx_XXX extends t3lib_XXX{":

==START==
require_once (PATH_t3lib.'class.t3lib_page.php');
require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');
==ENDE==



IN die "class tx_XXX ...":

==START==
function loadTS($pageUid) {
   $sysPageObj = t3lib_div::makeInstance('t3lib_pageSelect');
   $rootLine = $sysPageObj->getRootLine($pageUid);
   $TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
   $TSObj->tt_track = 0;
   $TSObj->init();
   $TSObj->runThroughTemplates($rootLine);
   $TSObj->generateConfig();
   $this->conf = $TSObj->setup;

   // FOLGENDE ZEILE BITTE ANPASSEN ("EXTENSION" ersetzen) !!!
   $this->extConf = $TSObj->setup['plugin.']['tx_EXTENSION_pi1.'];
}
==ENDE==



IN die "function init()" (oder, falls nicht vorhanden, in eure 
Haupt-Funktion, in der Ihr das TS benoetigt):

==START==
$this->loadTS(t3lib_div::GPVar('id'));
==ENDE==



Nun steht euch euer TypoScript in 2 Variablen zur Verfuegung.

- $this->conf
Sie enthaelt euer KOMPLETTES (!!) TypoScript.

- $this->extConf
Sie enthaelt euer Extension-Template. (Sofern Ihr die vorletzte Zeile 
der "function loadTS()" entsprechend angepasst habt.)


!! ACHTUNG !!
Bitte beachtet, dass das TypoScript der aktuellen Backendseite 
ausgelesen wird und das ganze dementsprechend nur funktioniert, wenn Ihr 
euch auf einer Backendseite befindet. (Also z.B. in der 
BE-Benutzerverwaltung wuerde es NICHT funktionieren.)

Das TypoScript wird rekursiv aufwaerts (!!) verwendet.
Beispiel:
root
-start
--home (< typoscript)
---news (< aktuelle position)
----newsordner (< typoscript)
----newsarchiv
- ...

Im Backend der "news"-Seite wird das TypoScript von "home" verwendet, 
jedoch NICHT das TS vom "newsordner".
(Also wie immer. Das uebergeordnete TS wird verwendet.)

Ich hoffe, ich habe das halbwegs verstaendlich erklaert.

mfg
Fabian


More information about the TYPO3-german mailing list