schau mal genau hin, $this ist nicht korrekt.
$GLOBALS['TSFE']->cObj
schau mal genau hin, $this ist nicht korrekt.
$GLOBALS['TSFE']->cObj
ok danke....nun bekomme ich ein weiteren fehler...die klasse t3lib_timeTrack ist nicht bekannt. muss ich noch eine php datei einbinden?
du machst dir nämlich ein objekt dieser klasse:
/* Begin */
if (!is_object($GLOBALS['TT'])) {
$GLOBALS['TT'] = new t3lib_timeTrack;
$GLOBALS['TT']->start();
}
um es vorwegzunehmen - das cObj zu benutzen ist nicht trivial, da im BE die Pfade komplett anders sind.
Ich habe es bisher auch nur geschafft, das cObj zu erstellen, die IMAGE-Funktion scheint noch andere Pfade zu suchen, es ist also Pioniergeist gefragt.
Hier die funktionierende Version fürs BE-Modul:
#needed for TSFE
require_once(PATH_t3lib.'class.t3lib_timetrack.php');
require_once(PATH_t3lib.'class.t3lib_tsparser_ext.php');
require_once(PATH_t3lib.'class.t3lib_page.php');
require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
require_once($BACK_PATH.'sysext/cms/tslib/class.tslib_fe.php');
require_once($BACK_PATH.'sysext/cms/tslib/class.tslib_content.php');
require_once($BACK_PATH.'sysext/cms/tslib/class.tslib_gifbuilder.php');
function buildTSFE() {
/* Declare */
$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
/* Begin */
if (!is_object($GLOBALS['TT'])) {
$GLOBALS['TT'] = new t3lib_timeTrack;
$GLOBALS['TT']->start();
}
if (!is_object($GLOBALS['TSFE']) && $this->id) {
//*** Builds TSFE object
$GLOBALS['TSFE'] = new $temp_TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],$this->id,0,0,0,0,0,0);
//*** Builds sub objects
$GLOBALS['TSFE']->tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
$GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
//*** init template
$GLOBALS['TSFE']->tmpl->tt_track = 0;// Do not log time-performance information
$GLOBALS['TSFE']->tmpl->init();
$rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($this->id);
//*** This generates the constants/config + hierarchy info for the template.
$GLOBALS['TSFE']->tmpl->runThroughTemplates($rootLine,$template_uid);
$GLOBALS['TSFE']->tmpl->generateConfig();
$GLOBALS['TSFE']->tmpl->loaded=1;
//*** Get config array and other init from pagegen
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->linkVars = ''.$GLOBALS['TSFE']->config['config']['linkVars'];
if($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP']) {
foreach (t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1) as $temp_p) {
$GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
}
}
//*** Builds a cObj
$GLOBALS['TSFE']->newCObj();
}
}
wenn ich ein var_dump auf $GLOBALS['TSFE'] mache, ist dieser null...
benutze nun die selbe funktion wie die, die du gepostet hast.
in einer anderen funktion rufe ich diese auf und mache danach ein var_dump auf $GLOBALS['TSFE']. ergebnis: null
hast Du auch $this->pid durch $this->id ersetzt ? Hast Du auch im Seitenbaum eine Seite angeklickt ?
die extension ist im be eingebunden und ich habe die seite angeklickt.
mein code:
function buildTSFE()
{
/* Declare */
$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
/* Begin */
if (!is_object($GLOBALS['TT'])) {
$GLOBALS['TT'] = new t3lib_timeTrack;
$GLOBALS['TT']->start();
}
if (!is_object($GLOBALS['TSFE']) && $this->id) {
//*** Builds TSFE object
$GLOBALS['TSFE'] = new $temp_TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],$this->id,0,0,0,0,0,0);
//*** Builds sub objects
$GLOBALS['TSFE']->tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
$GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
//*** init template
$GLOBALS['TSFE']->tmpl->tt_track = 0;// Do not log time-performance information
$GLOBALS['TSFE']->tmpl->init();
$rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($this->id);
//*** This generates the constants/config + hierarchy info for the template.
$GLOBALS['TSFE']->tmpl->runThroughTemplates($rootLine,$template_uid);
$GLOBALS['TSFE']->tmpl->generateConfig();
$GLOBALS['TSFE']->tmpl->loaded=1;
//*** Get config array and other init from pagegen
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->linkVars = ''.$GLOBALS['TSFE']->config['config']['linkVars'];
if($GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP']) {
foreach (t3lib_div::trimExplode(',',$GLOBALS['TSFE']->config['config']['simulateStaticDocuments_pEnc_onlyP'],1) as $temp_p) {
$GLOBALS['TSFE']->pEncAllowedParamNames[$temp_p]=1;
}
}
//*** Builds a cObj
$GLOBALS['TSFE']->newCObj();
}
}
function meineFunktion()
{
$this->buildTSFE();
var_dump($GLOBALS['TSFE']);
}
var_dump ? :o komplett falsche Methode, es handelt sich um ein Objekt.
t3lib_div::debug($GLOBALS['TSFE']);
mit var_dump würde ich dennoch etwas sehen....mit t3lib_div::debug($GLOBALS['TSFE']); bekomme ich ausschließlich ein "debug", also ohne inhalt.
falsch, var_dump gibt NULL aus, debug das komplette Objekt.
Bei mir klappt das hervorragend, also musst Du an anderer Stelle was falsch machen.
ich muss mich revidieren: var_dump gibt auch Objekte aus.
Die debug-Methode der t3lib_div-Klasse bietet aber eine besser lesbare Variante.
hallo nochmal,
du meintest, das ich die einstellungen für imagemagic per php folgend mache:
$conf['file.']['maxW']=200;
ich habe nun mal im frontend diese einstellungen gemacht:
$conf['file.']['maxW']=200;
$conf['file.']['maxH']=200;
$conf['file'] = $path.$pic;
$pic = $this->cObj->IMAGE($conf);
leider bleibt $pic leer!?
ein var_dump von $conf gibt zeigt folgendes:
array(2) { ["file"]=> string(49) "./uploads/tx_gebrauchtmanager/images233535145.jpg" ["file."]=> array(2) { ["maxW"]=> int(200) ["maxH"]=> int(200) } }
bei mir funktioniert es... ich möcht aber nicht mit $this->id arbeiten da ich den pagetree nicht brauche... werde ein standard wert nehmen
var_dump ist in folgender benutzung das äquivalent zu t3lib_div::debug($GLOBALS['TSFE']);
echo "<pre>";
var_dump($var);
echo "</pre>";
gibt es auch noch eine andere möglichkeit?
So funktioniert auch $GLOBALS['TSFE']->cObj->fileResource();
nicht weil die funktion filesize() wahrscheinlich ein falschen
pfad abbekommt...
eine Idee?
Möchte auch gerne Bilder im BE mittels der cObj Funktion IMAGE erstellen. Oder gibt es evtl. noch eine andere Möglichkeit?