toc
Re: toc
But he may not always want the full sitemap, he just wants the one of the current branch.
I suppose. So an open submenu to the last level.
I suppose. So an open submenu to the last level.
Gruß Olaf, Plugins for CMSimple_XH
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.
Re: toc
By the way:
What ustalo is looking for, I could use right now.
One side.
A navigation at the top - only level 1 is displayed.
Below, a list of all subpages from exactly this page.
But (in my case) only the Level2 pages should be displayed. The Level3 and all other levels should be opened by a click (possibly animated).
Therefore all levels below Level2 should be available.
If you then click on a Level3 link, a page change can take place (also for Level2).
The opened page should then again show all sublevels of the corresponding Level1 page. Ideally also the corresponding opened menu.
This is quite tricky and I have failed so far.
For the time being I have to do without it.
A pity.
What ustalo is looking for, I could use right now.
One side.
A navigation at the top - only level 1 is displayed.
Below, a list of all subpages from exactly this page.
But (in my case) only the Level2 pages should be displayed. The Level3 and all other levels should be opened by a click (possibly animated).
Therefore all levels below Level2 should be available.
If you then click on a Level3 link, a page change can take place (also for Level2).
The opened page should then again show all sublevels of the corresponding Level1 page. Ideally also the corresponding opened menu.
This is quite tricky and I have failed so far.
For the time being I have to do without it.
A pity.
Re: toc
Not really. The responsibility of li() and XH\Li are to generate the properly nested <ul> structure for a menu, and to add the desired CSS classes. The pages which are part of that structure, have to be passed in; e.g. $hc contains all visible pages.
Anyhow, maybe you're looking for something like the following?
Code: Select all
<?php
function get_decendants(XH\Pages $pages, $page)
{
$all = $children = $pages->children($page);
foreach ($children as $child) {
$grandchildren = get_decendants($pages, $child);
$all = array_merge($all, $grandchildren);
}
return $all;
}
function open_submenu()
{
global $s;
if ($s < 0) return '';
$pages = new XH\Pages;
$descendants = array_unique(get_decendants($pages, $s), SORT_NUMERIC);
sort($descendants, SORT_NUMERIC);
return li($descendants, 'submenu');
}
?>
<nav><?=open_submenu()?></nav>
Christoph M. Becker – Plugins for CMSimple_XH
Re: toc
... and put the code into userfuncs.php, you can also call the customized submenu in a page with
Code: Select all
{{{open_submenu();}}}
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“ Ludwig's XH-Templates for MultiPage & OnePage
Re: toc
I think that's what's wanted.cmb wrote: ↑Fri Aug 14, 2020 4:57 pmAnyhow, maybe you're looking for something like the following?Code: Select all
<?php function get_decendants(XH\Pages $pages, $page) { $all = $children = $pages->children($page); foreach ($children as $child) { $grandchildren = get_decendants($pages, $child); $all = array_merge($all, $grandchildren); } return $all; } function open_submenu() { global $s; if ($s < 0) return ''; $pages = new XH\Pages; $descendants = array_unique(get_decendants($pages, $s), SORT_NUMERIC); sort($descendants, SORT_NUMERIC); return li($descendants, 'submenu'); } ?> <nav><?=open_submenu()?></nav>
I would just
Code: Select all
return li($descendants, 'submenu');
Code: Select all
return li($descendants, 'sitemaplevel');
Gruß Olaf, Plugins for CMSimple_XH
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.
Re: toc
Wow!
That should already be largely what ustalo is looking for.
This can be done in the userfuncs.php, but also directly in the template.
Unfortunately, it still doesn't help me, because I need the whole menu below the L1 page in question.
Re: toc
I think that should already work.
Um, I don't quite understand. As it is now (or more precisely, how it is supposed to be now), open_submenu() should display links to all subpages (and sub-subpages etc.).
Christoph M. Becker – Plugins for CMSimple_XH
Re: toc
Ja, Aleksei (ustalo) dürfte sehr zufrieden sein mit deinem Code. Einfach genial.
Mein Anliegen war etwas anders gelagert. (Ich schreibe weiter in Deutsch, weil es ja eigentlich ein anderes Thema ist und ich mich vielleicht vertändlicher ausdrücken kann.)
open_submenu() zeigt alle Unter- und Unter-Seiten an.
Ich benötige hingegen immer den gesamten Menüzweig (ab L2) unterhalb einer L1-Seite, egal ob man sich auf einer L2, L3 ... Seite befindet.
Außerdem muss die aktuell geöffnete Seite im Menü mindestens markiert sein, damit ersichtlich ist wo man sich in dem Zweig befindet.
Geplant war, alle Unterseiten >L2 einzuklappen und nur den aktuellen Zweig zu öffnen. Die anderen müssen aber vorhanden sein, damit man sie per Klick öffnen (aufklappen) kann.
Das soll also ähnlich funktionieren, wie das Menü in fhs_adminmenu - nur eben mit allen Menüpunkten unterhalb einer L1-Seite. Im Idealfall sollte eben auch der aktuelle Zweig bei Aufruf geöffnet sein und die aktuelle Seite hervorgehoben.