htmly
htmly copied to clipboard
Include static subpages navigation
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,
do you have any example of this ?
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.
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.