[TYPO3-dev] How to set BE_MOD variables with Typoscript?

JoH asenau info at cybercraft.de
Sat Dec 9 17:55:54 CET 2006


> But at least if not, the meaning of the id is nonsense.

Sorry, but could you stop calling stuff "nonsense" just because you don't
understand it.

> I tested
> $this->modTSconfig =
> t3lib_BEfunc::getModTSconfig($id,'mod.web_txtemplavoilaM1');
>
> the value of the 'id' was 999999 and there is no such page.
> The infomation should not exist but the result was the same
> as setting
> $this->modTSconfig =
> t3lib_BEfunc::getModTSconfig(0,'mod.web_txtemplavoilaM1');
>
> because the first parameter for getModTSconfig seems to be nonsential,
> why it exists overall?

Because it will give you the correct settings of the page _if_ the page with
this id exists.

 function getModTSconfig($id,$TSref) {
  $pageTS_modOptions =
$GLOBALS['BE_USER']->getTSConfig($TSref,t3lib_BEfunc::getPagesTSconfig($id))
;
  $BE_USER_modOptions = $GLOBALS['BE_USER']->getTSConfig($TSref);
  $modTSconfig =
t3lib_div::array_merge_recursive_overrule($pageTS_modOptions,$BE_USER_modOpt
ions);
  return $modTSconfig;
 }

Else it will give you the settings for the specific branch of that page, as
long as there are some values available in the rootline.
Take a look at the beginning of getPagesTSconfig

function getPagesTSconfig($id,$rootLine='',$returnPartArray=0) {
  $id=intval($id);
  if (!is_array($rootLine)) {
   $rootLine = t3lib_BEfunc::BEgetRootLine($id,'',TRUE);
  }
[...]

As you can see, this will always return at least something, because the
returned array is _merged_ from _both_ page TSconfig _and_ user TS config.
If there is no page TS config for the desired $id, the values are taken
recursively from the rootline.
So it doesn't matter if the page itself or just the TS config of this page
doesn't exist.
As you already noticed, there is no difference, since in your case the page
TS config from the rootpage will be used for both options $id=0 or
$id=999999 (non existent page).
But _if_ there is page TS config available for $id, then you might get
additional stuff that is not available in user TS config.

Still nonsense?

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com






More information about the TYPO3-dev mailing list