[Typo3-dev] cObj Error when using hook
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Thu Dec 22 12:22:41 CET 2005
Thomas Mammitzsch schrieb:
> Dmitry Dulepov schrieb:
> > Thomas Mammitzsch wrote:
>
>>
>>> i try to use a hook within css_styled_content in typo 3.8.1 with my
>>> extension. I want to use an own render_uploads() function (in fact i use
>>> a copy of the original, only some html-rendering will be changed). but
>>> if i use the _unchanged_ copy of this function in my ext i get this
>>> error:
>>>
>>> Fatal error: Call to a member function on a non-object in
>>> D:\xampp\xampp\eclipse\workspace\typo3.8.1\typo3conf\ext\user_fileupload\pi1\class.user_fileupload_pi1.php
>>>
>>> on line 52
>>>
>>> i commented out this lines and the error message disappeared:
>>>
>>> line 52:
>>> $fileList = $this->cObj->stdWrap($this->cObj->data['media'],$lConf);
>>>
>>> line 132:
>>> $out = $this->cObj->stdWrap($out, $conf['stdWrap.']);
>>>
>>> i really don't have an idea, why this doesn't work. maybe you can
>>> help me?
>>
>>
>>
>> You do not have cObj member in your class right? :) this is why error
>> appears. You probably can use $GLOBALS['TSFE']->newCObj() to get cObj.
>>
>> Dmitry.
>
>
> hi,
>
> i didn't know that i have to create an instance of Cobj first.
> css_styled_content also doesn't do this. i thougt this would be done
> outside of my extension....
>
> i tried it and put it in my function, but it still doesn't work and
> throws the same error as before.
Ahem, the call references $this. Anyway, AFAIR, all hook functiosn have
a reference in $params['pObj'], so you can access the properties of the
"parent" object.
Masi
More information about the TYPO3-dev
mailing list