Query certain pages children then more. :)

So within the homepage or our site. We need to query the children of a certain page. Display those page titles. Then when someone clicks on one of those children it would display the information from that children in a tab. You can see in the image. I’ve looked for a solution like this, so if you’ve seen anything like this or know how to do this. :slight_smile:

It would work like this.
The Tools of Airportal - 1st page
– Travel Manager Dashboard - App 2nd page.
— All Access Intutive interface and 1st & only app - 3rd pages.
Then it would query the information about the 3rd page when they click on any one of the tabs.

So we’re actually calling a page Tools - then it’s children “like: Travel Manager Dashboard” -> then it’s children All access, etc. Then the information from that page.

We have all our YAML setup and pages setup, just not sure how to query this information in.

Thanks

I think i have javascript to handle this. I just need to know how to call to a specific page and pull in the children and grandchildren. Then the information from the grandchildren in Kirby.

I was looking at some menu information, but that didn’t seem to work right.

<?php

// selective items

$items = $pages->find('tools-of-airportal', 'faq', 'support');

if($items and $items->count()):

    ?>
    <nav>
        <ul>
            <?php foreach($items as $item): ?>
                <li>
                    <a<?php e($item->isOpen(), ' class="active"') ?> href="<?php echo $item->url() ?>"><?php echo $item->title()->html() ?></a>

                    <?php

                    // get all children for the current menu item
                    $children = $item->children();

                    // display the submenu if children are available
                    if($children->count() > 0):

                        ?>
                        <ul>
                            <?php foreach($children as $child): ?>
                                <li><a<?php e($child->isOpen(), ' class="active"') ?> href="<?php echo $child->url() ?>"><?php echo $child->title()->html() ?></a></li>
                            <?php endforeach ?>
                        </ul>
                    <?php endif ?>

                </li>
            <?php endforeach ?>
        </ul>
    </nav>
<?php endif ?>

So far, now working on quarying the grandchildren.

Yes, you need Javascript if you want to load that content into the page. The Ajax Load More recipe should have some useful information for you and there are already some more solutions in the forum.

We are using foundation 6

This seems to solve the problem. Now we are working on nesting.

<?php

// selective items

$items = $pages->find('tools-of-airportal', 'support');

if($items and $items->count()):

    ?>
    <div>
        <ul>
            <?php foreach($items as $item): ?>
                <li>
                    <a<?php e($item->isOpen(), ' class="active"') ?> href="<?php echo $item->url() ?>"><?php echo $item->title()->html() ?></a>

                    <?php

                    // get all children for the current menu item
                    $children = $item->children();

                    // display the submenu if children are available
                    if($children->count() > 0):

                        ?>
                        <ul>
                            <?php foreach($children as $child): ?>
                                <li><a<?php e($child->isOpen(), ' class="active"') ?> href="<?php echo $child->url() ?>"><?php echo $child->title()->html() ?></a></li>
                            <?php endforeach ?>
                        </ul>
                    <?php endif ?>

                </li>
            <?php endforeach ?>
        </ul>
    </div>
<?php endif ?>

<?php foreach ($pages->find('tools-of-airportal')->children() as $section): ?>test
<ul class="tabs" data-active-collapse="true" data-tabs id="collapsing-tabs">
        <?php foreach ($section->children() as $project): ?>


            <li class="tabs-title"><a href="#<?= $project->tabid() ?>"><?= $project->title() ?></a></li>

        <?php endforeach ?>


</ul>
<?php endforeach ?>





<?php foreach ($pages->find('tools-of-airportal')->children() as $section): ?>


<div class="tabs-content" data-tabs-content="collapsing-tabs">
    <?php foreach ($section->children() as $project): ?>

        <div class="tabs-panel is-active" id="<?= $project->tabid() ?>">
                    <p><?= $project->text() ?></p>
                </div>


            <?php endforeach ?>
</div>

<?php endforeach ?>