Project

General

Profile

Actions

Bug #19198

closed

TCA is not loaded completely when "dynamicConfigFile" is used.

Added by Peter Klein over 16 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-08-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

TCA is not loaded completely when "dynamicConfigFile" is used.

The Typoscript below illustrates the problem.
It wil show the correct text value for the 1st example everytime, but for the 2nd it wil show the numeric value just after clearing cache.
The only difference between the 2 table setups, is that the 2nd is using "dynamicConfigFile"

Debugging also shows that in the 2nd case, only the "ctrl" section of TCA is loaded.

lib.tcatest = COA
lib.tcatest { # This part always work due to table setup is defined directly
10 = TEXT
10.value = 1
10.TCAselectItem.table = pages
10.TCAselectItem.field = fe_login_mode
10.wrap = <p>TCAselectItem=|</p>

  1. This part fails once just after clearing cache due to table setup is defined in tca.php using dynamicConfigFile
    20 = TEXT
    20.value = 1
    20.TCAselectItem.table = static_countries
    20.TCAselectItem.field = cn_address_format
    20.wrap = <p>TCAselectItem=|</p>
    }

page.1 < lib.tcatest

(issue imported from #M9131)

Actions #1

Updated by Peter Klein over 16 years ago

Forgot to mention how to test it.

1) Insert the TS in setup, then clear cache and view page in FE.
Notice that the 2nd value is numeric, which is wrong.

2) Then move to another page, and you'll see that the 2nd parameter is now correctly displayed as a text.

Actions #2

Updated by Peter Klein over 16 years ago

Solution:
Change the function "loadTCA" in the file "\typo3\sysext\cms\tslib\class.tslib_fe.php", from:

-- cut --
function includeTCA($TCAloaded=1) {
global $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS, $TBE_MODULES;
if (!$this->TCAloaded) {
$TCA = Array();
include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php');
// Extension additions
if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php');
} else {
include(PATH_t3lib.'stddb/load_ext_tables.php');
}
// ext-script
if (TYPO3_extTableDef_script) {
include (PATH_typo3conf.TYPO3_extTableDef_script);
}
$this->TCAloaded = $TCAloaded;
}
}
-- cut --

into:

-- cut --
function includeTCA($TCAloaded=1) {
global $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS, $TBE_MODULES;
if (!$this->TCAloaded) {
$TCA = Array();
include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script : PATH_t3lib.'stddb/tables.php');
// Extension additions
if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php');
} else {
include(PATH_t3lib.'stddb/load_ext_tables.php');
}
// ext-script
if (TYPO3_extTableDef_script) {
include (PATH_typo3conf.TYPO3_extTableDef_script);
}
reset($TCA);
while(list($table)=each($TCA)) {
t3lib_div::loadTCA($table);
}
$this->TCAloaded = $TCAloaded;
}
}
-- cut --

Actions #3

Updated by Petra Arentzen about 15 years ago

Hallo,

just for info: problem still resides - found it in version 4.2.9.

But I suggest applying t3lib_div::loadTCA() for all table may result in performance problem.

Why not only loading required table?

\typo3\sysext\cms\tslib\class.tslib_content.php:

-- cut --
function TCAlookup($inputValue,$conf) {
global $TCA;

$table = $conf['table'];
$field = $conf['field'];
$delimiter = $conf['delimiter']?$conf['delimiter']:' ,';
$GLOBALS['TSFE']->includeTCA();
// --- start modification ---
if (is_array($TCA[$table])) {
t3lib_div::loadTCA($table);
}
// --- end modification ---
if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field]) && is_array($TCA[$table]['columns'][$field]['config']['items'])) {
$values = t3lib_div::trimExplode(',',$inputValue);
$output = array();
foreach ($values as $value) {
// Traverse the items-array...
reset($TCA[$table]['columns'][$field]['config']['items']);
while (list($key,$item)=each($TCA[$table]['columns'][$field]['config']['items'])) {
// ... and return the first found label where the value was equal to $key
if (!strcmp($item[1],trim($value))) {
$output[] = $GLOBALS['TSFE']->sL($item[0]);
}
}
}
$returnValue = implode($delimiter,$output);
} else {
$returnValue = $inputValue;
}
return $returnValue;
}
-- cut --
Actions #4

Updated by Alexander Opitz over 11 years ago

  • Category deleted (Communication)
  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #5

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed
  • Is Regression set to No

No feedback for over 90 days.

Actions

Also available in: Atom PDF