Zum Inhalt springen

Wert aus PHP-Skript als TS-Parameter?

Erstellt am 17. Juni 2005 · 1 Antwort · letzte Antwort am 17. Juni 2005

Tags: Frage

MrFriendly ·

Hallo,

wie kann ich z.B. einen in PHP erzeugten Wert als Wert für das HMENU-Attribut maxItems einsetzen?

PHP ist schon vorhanden:

<?php

  class user_navBoxItems
  {
    function maxNumOfTd1()
    {
      global $GLOBALS;
    
      $content = $GLOBALS["TSFE"]->sys_page->getMenu($GLOBALS["TSFE"]->id);
      $output = sizeof($content);
      $output = ceil($output/2);

      return $output;
    }
	
    function begNumOfTd2()
    {
      global $GLOBALS;
		
      $content = $GLOBALS["TSFE"]->sys_page->getMenu($GLOBALS["TSFE"]->id);
      $output = sizeof($content);
      $output = ceil($output/2)+1;

      return $output;
    }
  }
?>

Die Funktionen kann ich von Typo3 auch schon ansprechen (includeLibs im Haupttemplate):

ext.navbox = COA
ext.navbox {
  5 = USER
  5.userFunc = user_navBoxItems->maxNumOfTd1
}

Wenn ich z.B. in PHP ein echo mache, wird der korrekte Wert damit auch ausgegebn. Wie weise ich aber nun meinem HMENU bzw. maxItems den richtigen Wert zu?

ext.navbox = COA
ext.navbox {
  5 = USER
  5.userFunc = user_navBoxItems->maxNumOfTd1

  20 = HMENU
  20.special = directory
  20.special.field = uid
  20.maxItems = ?
  20.1 = TMENU
  ...
}
jenses ·

versuchs mal so :

ext.navbox = COA
ext.navbox {
  5 = USER
  5.userFunc = user_navBoxItems->maxNumOfTd1

  20 = HMENU
  20.special = directory
  20.special.field = uid
  20.maxItems.cObject < .5
  20.1 = TMENU
  ...
}

Ungetestet, aber per cObject kommst du an den Wert.
Nur das genaue "Wie" mußt du noch ausprobieren.

Etwas Ähnliches übergibt bei mir den aktuellen Monatsnamen an den GifBuilder:

temp.monatsname = USER
temp.monatsname.userFunc = user_monatsbilder->user_monatsname
temp.top_image.file.30 = TEXT
temp.top_image.file.30.text.cObject < temp.monatsname

jenses