[TYPO3] external Databasetable

André Esch andre at unbequem.com
Mon Sep 4 10:58:27 CEST 2006


Hello List,

I have a problem using a table of an external database.
I'm using the extensions ADOodb, dbal and datasource.

It works pretty fine, I can read and write in my external
databasetable but, typo3 looks for two internal tables
(pages and sys_refindex) in my external database, while
handling my external table. Does anyone had this Problem
before?

This is my datasource-config:
$TYPO3_CONF_VARS['EXTCONF']['dbal']['handlerCfg'] = array (
         '_DEFAULT' => array (
             'type' => 'adodb',
             'config' => array(
                 'driver' => 'mysql',
             )
         )
     );
$TYPO3_CONF_VARS['EXTCONF']['dbal']['handlerCfg'] = array (
         '_DEFAULT' => array (
             'type' => 'native',
             'config' => array(
                 'username' => 'username',        // Set by default 
(overridden)
                 'password' => 'password',        // Set by default 
(overridden)
                 'host' => 'host',            // Set by default (overridden)
                 'database' => 'datebase',        // Set by default 
(overridden)
             )
         ),
         'alternativeMySQLdb' => array (
             'type' => 'native',
             'config' => array(
                 'username' => 'username',       
                 'password' => 'password',       
                 'host' => 'host',       
                 'database' => 'externaldatabasename',       
             )
         ),
     );
 
$TYPO3_CONF_VARS['EXTCONF']['dbal']['table2handlerKeys'] = array (
         'Filme' => 'alternativeMySQLdb',
         'pages' => '_DEFAULT',
         'sys_refindex' => '_DEFAULT',
     );


this ist my ext_tables-code:
t3lib_extMgm::allowTableOnStandardPages("Filme");

t3lib_extMgm::addToInsertRecords("Filme");

t3lib_extMgm::addPlugin(array('LLL:EXT:extdata/locallang_db.xml:tt_content.list_type_pi1', 
$_EXTKEY.'_pi1'),'list_type');

if (TYPO3_MODE=="BE")    
$TBE_MODULES_EXT["xMOD_db_new_content_el"]["addElClasses"]["tx_extdata_pi1_wizicon"] 
= t3lib_extMgm::extPath($_EXTKEY).'pi1/class.tx_extdata_pi1_wizicon.php';

t3lib_extMgm::addToInsertRecords("Filme");

$TCA["Filme"] = Array (
    "ctrl" => Array (
        'title' => 'LLL:EXT:extdata/locallang_db.xml:Filme',       
        'label' => 'titel',   
        'label_alt' => 'jahr',
        'label_alt_force' => 1,
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'cruser_id' => 'cruser_id',
        "default_sortby" => "ORDER BY titel",   
        "dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY)."tca.php",
        "iconfile" => 
t3lib_extMgm::extRelPath($_EXTKEY)."icon_tx_extdata_test.gif",
    ),
    "feInterface" => Array (
        "fe_admin_fieldList" => 
"uid,titel,edi,dauer,jahr,kurztext,langtext",
    )
);

And this is the code of my pi1_extension:
list($this->internal['orderBy'],$this->internal['descFlag']) = 
explode(':',$this->piVars['sort']);

$this->internal['results_at_a_time']=t3lib_div::intInRange($lConf['results_at_a_time'],0,1000,100);    
   
$this->internal['maxPages']=t3lib_div::intInRange($lConf['maxPages'],0,1000,8);
$this->internal['searchFieldList']='titel';
$this->internal['orderByList']='titel,jahr';
       
$res = $this->pi_exec_query('Filme',1,' and bundesstart < 
'.date('Y').'-'.date('m').'-'.date('d').' ');       
list($this->internal['res_count']) = 
$GLOBALS['TYPO3_DB']->sql_fetch_row($res);
       
$res = $this->pi_exec_query('Filme','',' and bundesstart < 
'.date('Y').'-'.date('m').'-'.date('d').' ','','',' bundesstart ASC, 
jahr desc, titel ASC');
$this->internal['currentTable'] = 'Filme';       
           
$fullTable='';    // Clear var;
$fullTable.=$this->pi_list_makelist($res);

In a german Forum you'll find a that code in a bit more comfortable 
</?s=comfortable> way to read:
http://www.typo3forum.net/forum/extension-modifizieren-oder-neu-erstellen/16564-fremddatenbank-nutzen.html

I hope you can help me out, because I'm despaired </?s=despaired>.

Best regards from cologne
André Esch



More information about the TYPO3-english mailing list