Hallo.
Bin leider erst vor ein paar Tagen mit Typo3 angefangen. Daher ist mein Problem für mich derzeit unlösbar.
Ausgangssituation
Ich benötige ein Menu mit drei Ebenen, das jedoch nicht der normalen Seitenhierarchie entspricht. Dazu habe ich ein PHP-script über HMENU -> special = userdefined eingebunden, wie im Beispiel Example: Creating hierarchical menus of custom links unter https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Hmenu/Index.html beschrieben wurde. Die so erzeugte Hierarchie stelle ich dann mit einem TMENU mit drei Ebenen dar. Dies funktioniert auch prima, allerdings sind alle Menupunkte voll ausgeklappt und lassen sich nicht wie normalerweise (z.B. wenn ich special = directory nutze) einklappen.
folgender TS
MENU_KURSE = HMENU
MENU_KURSE {
wrap = <ul>|</ul>
special = userdefined
special.file = fileadmin/menuTest2.php
1 = TMENU
1.collapse = 1
1 {
NO = 1
NO.allWrap = <li>|</li>
NO.stdWrap.htmlSpecialChars = 1
ACT = 1
ACT.allWrap = <li>|</li>
ACT.stdWrap.htmlSpecialChars = 1
ACTIFSUB = 1
ACTIFSUB.allWrap = <li>|
ACTIFSUB.stdWrap.htmlSpecialChars = 1
}
2 = TMENU
2 {
wrap = <ul>|</ul></li>
NO = 1
NO.allWrap = <li>|</li>
NO.stdWrap.htmlSpecialChars = 1
ACT = 1
ACT.allWrap = <li>|</li>
ACT.stdWrap.htmlSpecialChars = 1
}
3 = TMENU
3 {
wrap = <ul>|</ul></li>
NO = 1
NO.allWrap = <li>|</li>
NO.stdWrap.htmlSpecialChars = 1
ACT = 1
ACT.allWrap = <li>|</li>
ACT.stdWrap.htmlSpecialChars = 1
}
}
So siehts aus - alle Ebenen aufgeklappt...
Frage
Wie erreiche ich das ein-(aus)klappen der einzelnen Ebenen je nach Belieben?
Hier die eingebunden menuTest2.php
function makeMenuArray($content, $conf)
{
$db = "****";
$user = "****";
$pass = "****";
$host = "****";
$db_connect = mysql_connect($host, $user, $pass);
$db_select = mysql_select_db($db);
$sql = "SELECT uid, title FROM `pages` WHERE `title` LIKE 'Kurs%' ORDER BY title ASC";
$rs = mysql_query($sql);
#echo $sql;
$x=0;
$menuItemsArray = array();
while($row = mysql_fetch_row($rs))
{
$menuItemsArray[] = array(
'title' => $row[1],
'_OVERRIDE_HREF' => 'index.php?id='.$row[0],
);
$sql1 = "SELECT uid, title FROM `pages` WHERE `pid` = $row[0] and title LIKE '%Module'";
$rs1 = mysql_query($sql1);
while($row1 = mysql_fetch_row($rs1))
{
$sql2 = "SELECT uid, title FROM `pages` WHERE `pid` = $row1[0]";
$rs2 = mysql_query($sql2);
$y=0;
while($row2 = mysql_fetch_row($rs2))
{
$menuItemsArray[$x][_SUB_MENU][$y] = array(
'title' => $row2[1],
'_OVERRIDE_HREF' => 'index.php?id='.$row2[0],
);
$sql3 = "SELECT uid, title FROM `pages` WHERE `pid` = $row2[0] and title LIKE '%Lektionen'";
$rs3 = mysql_query($sql3);
while($row3 = mysql_fetch_row($rs3))
{
$sql4 = "SELECT uid, title FROM `pages` WHERE `pid` = $row3[0] ";
$rs4 = mysql_query($sql4);
$z=0;
while($row4 = mysql_fetch_row($rs4))
{
$menuItemsArray[$x][_SUB_MENU][$y][_SUB_MENU][$z] = array(
'title' => $row4[1],
'_OVERRIDE_HREF' => 'index.php?id='.$row4[0],
);
$z++;
}
}
$y++;
}
}
$x++;
}
return $menuItemsArray;
}
$menuItemsArray = makeMenuArray($content, $conf);
Vielen Dank für eine Antwort. Ich werd nämlich bekloppt drüber ...