htmly icon indicating copy to clipboard operation
htmly copied to clipboard

Include static subpages navigation

Open FakePlasticBees opened this issue 8 years ago • 3 comments

Is it possible to include a subpage navigation into a page? Maybe it could be shown as a (un)ordered list/pagination,/prev-next/breadcrumbs kind of thing, It would be handy, especially on smaller mobile screens, if one can include the available subpages near the main content, for example below the last paragraph,

FakePlasticBees avatar Feb 09 '17 10:02 FakePlasticBees

do you have any example of this ?

noxymon avatar Feb 14 '17 03:02 noxymon

Say i have this menu, all static pages:

- static one
    - sub a
    - sub b
    - sub c
- static two
    - sub a
    - sub b
    - sub c
- static three
    - sub a
    - sub b
    - sub c

Now i would like include a sort of navigation of the subpages into into the template static.html.php, maybe via a function such as <?php echo $p->subnav; ?> or <?php echo $p->subnav(staticname) ; ?> that returns a list or array that I can loop tru. So when one is visiting static two, or one of its subpages, links to the other static two child pages should appear. This would improve navigation a lot, especially on mobile screens.

FakePlasticBees avatar Feb 14 '17 16:02 FakePlasticBees

Hello, sorry late for a few years.

Yes possible, we already have a function for it:

$static = substr($p->url, strrpos($p->url, "/") + 1);
$subPages = get_static_sub_post($static, null);

foreach ($subPages as $sp) {
// Your code here
}

That is not just the URL but even the content itself. Like displaying the subPages on the parent pages.

We need better docs.

danpros avatar Apr 12 '21 06:04 danpros