Project

General

Profile

Actions

Feature #20255

closed

helper function for handling with TYPOScript

Added by Sebastian Böttger about 15 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-03-30
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

in t3lib_div there should be a helper function for TYPOScript values.

The patch merges the following function into the core

/**
  • Helper function: slices a key from TYPOScript setup through different levels in an easy way
  • Example call: t3lib_div::getTSValue('key1.key2.key3', $this->conf); => return value of key1.key2.key3
  • @param string The path to find
  • @param array a TYPOScript setup array
  • @return mixed array if given path is TO node, string if given path is TO leave, empty string if the given path is empty, false if the given path is not set

  • */
    public function getTSValue($path, $conf) {
    $subkeys = explode('.',$path);
    $arr = $conf;
    $max = count($subkeys);
    for($i = 0; $i < $max; $i++) {
    $key = $subkeys[$i];
    if ($i < ($max - 1)) {
    $key .= '.';
    }
if (array_key_exists($key, $arr)) {
$arr = $arr[$key];
} else {
if (array_key_exists($key.'.', $arr)) {
$arr = $arr[$key.'.'];
} else {
return false;
}
}
}
return $arr;
}
(issue imported from #M10812)

Files

patch.txt (693 Bytes) patch.txt Administrator Admin, 2009-03-30 20:05
10812.patch (1.32 KB) 10812.patch Administrator Admin, 2009-03-30 20:07
Actions #1

Updated by Sebastian Böttger about 15 years ago

added the same file with bugnumber in name

Actions #2

Updated by Ingo Renner almost 14 years ago

don't blow up t3lib_div any further. it's a god class already. we need to think about breaking it up instead. I agree with the helper thing in general though, but there should be a better place to add this.

Actions #3

Updated by Ernesto Baschny over 13 years ago

This won't make it in 4.5.0 anymore, but have you done some thought on where we could add this function? We could have this starting in 4.6 then. Thanks for your help and contribution!

Actions #4

Updated by Xavier Perseguers almost 13 years ago

  • Target version changed from 4.6.0 to 4.6.0-beta1
Actions #5

Updated by Xavier Perseguers over 12 years ago

  • Target version deleted (4.6.0-beta1)
Actions #6

Updated by Alexander Opitz almost 11 years ago

As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?

Actions #7

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF