Project

General

Profile

Actions

Bug #14466

closed

Content returned from USER_INT cannot be manipulated by TypoScript

Added by Peter Klein almost 20 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2004-12-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.7.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Content returned from USER_INT cannot be manipulated by TypoScript functions like "split" & "listNum"

Example:

PHP class (saved as fileadmin/templates/functions.inc)
-- cut --

class user_uml{
function getRandomRecordIds($content,$conf){
$lCObj = t3lib_div::makeInstance("tslib_cObj");

$table = $conf['table'];
$pid = $conf['pid'];
$max = $conf['max'];
$query = 'SELECT * FROM '.$table.' WHERE pid='.$pid.$lCObj->enableFields($table).' ORDER BY RAND() LIMIT 0,'.$max;
$res = mysql(TYPO3_db,$query);
$ar = array();
while($row = mysql_fetch_assoc($res)){
$ar[] = $row['uid'];
}
return implode(",",$ar);
}
}

?>
-- cut --

CONSTANTS:
-- cut --
  1. Page ID where the records are located
    lib.randomRecords.pid = 350
  1. Table to get the records from
    lib.randomRecords.table = tt_address
  1. Max number of record IDs to return
    lib.randomRecords.max = 4
    -- cut --

SETUP:
-- cut --
lib.randomRecords2 = COA
lib.randomRecords2 {

10 = TEXT
10.cObject = USER_INT
10.cObject.userFunc = user_uml->getRandomRecordIds
10.cObject.pid = {$lib.randomRecords.pid}
10.cObject.table = {$lib.randomRecords.table}
10.cObject.max = {$lib.randomRecords.max}
10.wrap = This is the complete commaseperated list:: |<br>
20 < .10
20.listNum = 0
20.wrap = This should be the 1st item on the comma seperated list:&nbsp;|&lt;br&gt;
30 < .10
30.listNum = 1
30.wrap = And this should be the 2nd item on the comma seperated list:&nbsp;|&lt;br&gt;

}

lib.randomRecords3 = COA_INT
lib.randomRecords3 {

10 = TEXT
10.cObject = TEXT
10.cObject.preUserFunc = user_uml->getRandomRecordIds
10.cObject.preUserFunc.pid = {$lib.randomRecords.pid}
10.cObject.preUserFunc.table = {$lib.randomRecords.table}
10.cObject.preUserFunc.max = {$lib.randomRecords.max}
10.wrap = This is the complete commaseperated list::&nbsp;|&lt;br&gt;
20 < .10
20.listNum = 0
20.wrap = This should be the 1st item on the comma seperated list:&nbsp;|&lt;br&gt;
30 < .10
30.listNum = 1
30.wrap = And this should be the 2nd item on the comma seperated list:&nbsp;|&lt;br&gt;

}

  1. Default PAGE object:
    page = PAGE
    page.typeNum = 0
    page.6.value = <br><br>
    page.7 < lib.randomRecords2
    page.8 = TEXT
    page.8.value = <br><br>
    page.9 < lib.randomRecords3
    -- cut --

Running the test example above, outputs something like this:

This is the complete commaseperated list:: 1,2,6,4
This should be the 1st item on the comma seperated list: 6,5,4,2
And this should be the 2nd item on the comma seperated list:

This is the complete commaseperated list:: 1,6,3,4
This should be the 1st item on the comma seperated list: 6
And this should be the 2nd item on the comma seperated list: 4

Note that the 1st part doesn't get splitted up..
(Same happens when I use the "split" function)

(issue imported from #M639)

Actions #1

Updated by Mathias Schreiber over 18 years ago

TYPO3 Version too old.
The reported version is no longer maintained.

If this bug still persists in 4.0.1, please re-open it again and set the field "Product Version" to the corresponding version.

Actions

Also available in: Atom PDF