Jump to content

$children = $root->children("limit=150") doesnt work when in url segment from pagination


picarica
 Share

Recommended Posts

Hello so i managed to implement pagination to my site, i have navigation rendering done like so

$out = '';
$root = $pages->get("/");
$children = $root->children("limit=150");
// $children->prepend($root);
foreach($children as $child) {
    if($child->numChildren && $child->id !== 1) {// @note: you could do some more checks here;
        $out .= "<li>";
        $out .= "<a class='dropdown' href='javascript:void(0);'>{$child->title}</a>";
        $out .= "<ul>";
        foreach($child->children as $level1) {
            if ($level1->hasChildren()) {
             $out .= "<li>";
             /* if ($level1->numChildren()) {
                $out .= "<a href='{$level1->url}'>{$level1->title}</a>";
                $out .= "<ul>";
                 foreach($level1->children as $level2) {
                    $out .= "<li>";
                    $out .= "<a href='$level2->url'>$level2->title</a>";
                    $out .= "</li>";
                 }
                 $out .= "</ul>";
             } else { */
                $out .= "<a href='{$level1->url}'>{$level1->title}</a>";
             /* } */
             $out .= "</li>";
            }
        }
        $out .= "</ul>";
        $out .= "</li>";
    } else {
        $out .= "<li><a href='{$child->url}'>{$child->title}</a></li>";
    }
}
echo $out;
echo "<li><a href='{$root->url}'>{$root->title}</a></li>";

which works flawlessy for my page withing children any page, except when i enter pagination

the whole menu entry dissapears as i click link to page2 in pagination, idk why but when my url is www.page.sk/page2/ my navigation dissapears except the last entry which is

echo "<li><a href='{$root->url}'>{$root->title}</a></li>";

i tried debugging it and i found out that variable $children is just empty like why would $root->children("limit=150"); wouldn't work in url segment? is this some sort of bug ?

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...