[Typo3] Fix for Templavoila error: call to a member function on an non-object when using stdwrap
Fabian Schulz
schulz at truecare.de
Sun Dec 18 17:17:12 CET 2005
Hello,
I have had the mentioned error:
Fatal error: Call to a member function on a non-object in
/home/www/typo3_src-3.8.1/typo3/ext/templavoila/pi1/class.tx_templavoila_pi1.php
on line 416
When I was using something like this in the processing array of my Data
Structure:
<proc type="array">
<HSC type="integer">1</HSC>
<stdWrap>
<![CDATA[
wrap = TEST|TEST
]]>
</stdWrap>
</proc>
My quick and dirty solutions is quite simple:
1) make a backup of class.tx_templavoila_pi1.php
2) find the line causing the error, mine looked like:
$dataValues[$key][$valueKey] =
$cObj->stdWrap($dataValues[$key][$valueKey],$tsparserObj->setup);
Error is caused because $cObj is not set - I don't know why.
3) Set $cObj just before it is used:
if (trim($pOptions['stdWrap'])) {
/* HERE STARTS THE Quick and Dirty FIX */
$cObj =t3lib_div::makeInstance('tslib_cObj');
$cObj->setParent($this->cObj->data,$this->cObj->currentRecord);
$cObj->start($dataRecord,'_NO_TABLE');
$cObj->setCurrentVal($dataValues[$key][$valueKey]);
/* HERE ENDS THE FIX */
$tsparserObj = t3lib_div::makeInstance('t3lib_TSparser');
// BUG HERE: should convert array to TypoScript...
$tsparserObj->parse($pOptions['stdWrap']);
$dataValues[$key][$valueKey] =
$cObj->stdWrap($dataValues[$key][$valueKey],$tsparserObj->setup);
}
That's it.
Best whishes and a merry christmas to you!
Fabian
More information about the TYPO3-english
mailing list