[TYPO3-english] Class 't3lib_div' not found

Björn Pedersen pedersen at frm2.tum.de
Thu Mar 1 10:12:01 CET 2012


Am 01.03.2012 08:55, schrieb Deyan Yankov:
> Hello.
> 
> I have the following error in one of my plugins.
> 
> Fatal error: Class 't3lib_div' not found in
> C:\xampp\htdocs\EclipseProjects\IDECORimages\trunk\typo3conf\ext\idecorimages\classes\models\public.php
> on line 135
> 
> Here is the 135 row (see row numbers in the screenshot attached):
> 
>     public function getDB(){
>         if (!TYPO3_db)    {
>             return;
>         }       
>         if (!isset($GLOBALS['TYPO3_DB'])) {
>             $GLOBALS['TYPO3_DB'] = t3lib_div::makeInstance('t3lib_db');
>             if (!$GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host,
> TYPO3_db_username, TYPO3_db_password) ||
>                 !$GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db)) {
>                     // Cannot connect to database
>                     return;
>             }else{
>                 return $GLOBALS['TYPO3_DB'];               
>             }
>         }else{
>             return $GLOBALS['TYPO3_DB'];
>         }
>     }
> 
> Could you please help me with this problem? Why it cannot find the
> t3lib_div class, and how to load it together with the corresponding
> classes?
> 
> Regards,
> Deyan Yankov
> Goos Web Division

What are you trying to achieve? In a plugin you always can rely on
$GLOBALS['TYPO3_DB'] being available. Are you trying to write some
standalone script? Then you have to  run through the complete
initialization as well (including init.php, which will set up
autoloader, DB access  etc.). Maybe you don't need the full setup, then
you should look at eID.

Björn



More information about the TYPO3-english mailing list