Guten Tag,
ich habe heute ein Typo3-Update von 4.2.8 auf 4.4.4 durchgeführt. Innerhalb einer eigenen Extension benutze ich
eine Helper Class, welche für nützliche Funktionen innerhalb der Extension zuständig ist.
Die Class ist direkt im Extension-Ordner unter /lib/helper.php angelegt und wurde bisher immer included.
Ab jetzt bekomme ich ein "class not found error".
Innerhalb der einzelnen pis konnte ich ein Klassenobjekt bisher immer so erzeugen.....und dann die Methoden nutzen....
$this->helper = new ext_Name_Helper ( $this );
Kann es sein, daß diese Art und Weise der Nutzung von HelperClasses aus Sicherheitsgründen inzwischen abgelehnt wurde?
Freue mich auf Antworten...
Grüße
Gordon
Hallo Gordon,
wenn ich Helper Klassen in meine Plugins integriere geh ich so vor
In den Kopf der Plugin PHP Datei
require_once (t3lib_extMgm::extPath('myExt') . 'lib/class.tx_myExt_helper.php');
und dann instanzieren mit
$this->helper = t3lib_div::makeInstance('tx_myExt_helper');
Funktioniert tadellos. Du solltest auch besser die Methode von makeInstance() verwenden statt dem "new" Konstrukt von PHP.
/**
* Creates an instance of a class taking into account the class-extensions
* API of TYPO3. USE THIS method instead of the PHP "new" keyword.
* Eg. "$obj = new myclass;" should be "$obj = t3lib_div::makeInstance("myclass")" instead!
* You can also pass arguments for a constructor:
* t3lib_div::makeInstance('myClass', $arg1, $arg2, ..., $argN)
*
* @param string Class name to instantiate
* @return object A reference to the object
*/
public static function makeInstance($className)
Viele Grüße, Dirk
Hi Dirk,
danke für Deine Tipps....
Jetzt läuft wieder alles...:-)
Es ist wohl ab jetzt so, dass ich in jedes pi einen include der helper-class vornehmen muss. Vorher ging es ohne...
Grüße
Gordon