[TYPO3] Problems with reusing functions

Sebastian Fuchs sebastian at hexerei.net
Mon Jul 31 18:42:33 CEST 2006

hi Falk,
first of all, all the best with your broken leg.
By the way, where are you located in south america (i am looking for 
some (typo3-related) conntects there)?

Now to your problem:

Falk Walter wrote:
> Did it like that in class A:
> require_once(t3lib_extMgm::extPath('user_logframe_report').'/pi1/class.user_
> logframereport_pi1.php');
> Class A extends ... {
>     $this->userLogFrameReports =
> t3lib_div::makeInstance('user_logframereport_pi1');
> ....
> }
hmm, i think you dont extend the class in your class A but rather make a 
new instance of the class 'user_logframereport_pi1'. but that is not 
important for your problem.

> I can call functions from class B, but I got the following error message:
> Fatal error: Call to a member function typoLink() on a non-object in
> C:\Programme\typo3\htdocs\typo3wamp\typo3\sysext\cms\tslib\class.tslib_pibas
> e.php on line 315
> (At this line, a typolink-function gets called through the cObj:
> 		return $this->cObj->typoLink($str, $conf);
> )

this means that $this->cObj is not an object with a class function 

I dont understand how your classes interact and which is called by 
which, but as a workround you could create your own cObj (which is an 
object of the class tslib_cObj in tslib/class.tslib_content.php by the way).

$this->local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local Obj.
maybe you have to include the php class file first.

after that you could use the typolink function of this newly created 

I first saw this "hack" in the tt_news extension, but i came also many 
times to a point where i needed it.

maybe this helps,


More information about the TYPO3-english mailing list