Post Reply
Ssr. Bludit
Posts: 23
Joined: Tue Jun 11, 2019 11:36 am

Sat Jun 15, 2019 8:29 pm

Has anyone already generated a 3-level navigation? How can I address the child-child element?Please ask for information and help.
Thank you.
User avatar
Master Bludit
Posts: 89
Joined: Tue Dec 25, 2018 8:07 pm
Location: Austria 'n' Germany

Sun Jun 16, 2019 9:31 am


I guess, there is currently no frontend theme, which supports a multi-level navigation using paw.MoreLevels. But I'm using this plugin on my own, on a small internal project, and wrote the following snippet for a multi-level Table of Content Widget.

Note: This solution works ONLY if you're ordering the content after the position (and depth) on your own (or if you order the respective $data array manually, of course).

Code: Select all

$data = $pages->getPublishedDB();           // Get published Page Keys
$count = 0;
    $item = new Page(current($data));       // Get current Page Object
    $next = next($data);                    // Get next Page Key
            prev($data);                    // Reset $data Array
    // Just a Basic Example
    echo str_repeat("- ", $count) . $item->title() . "<br />";
    if(substr_count($next, "/") > $count){
    } else if(substr_count($next, "/") < $count){
        $count -= ($count - substr_count($next, "/"));
} while(next($data));
The result looks like this:


So, in fact, you need to create an own respective loop, fetch each page on your own and use the respective methods of the "Page" class to create your link / URL working.

If you really like my projects and want to support me, I would be extremely grateful for a coffee! (Thanks to all Supporters):

Post Reply