This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

devine_22762
devine_22762

Hello,

i have a small problem to give out the childpages of a childpage.

This is my structure:
Cars (Lists alle the car-categories)
.. car-categories (Here are the different categories to list)
.... car-categorie-items (The items for the car-categories)

Now i have the problem that the "car-categories" lists the same items as the main-page Cars.

Code of "Cars"

        {% for childPage in childPages %}
            <li class="list-group-item">
                <a href="{{ childPage.url|app }}">
                    {{ childPage.title }}
                </a>
            </li>
        {% endfor %}

this is the Code from cars-category

        {% for childPage in childPages %}
            <li class="list-group-item">
                <a href="{{ childPage.url|app }}">
                    {{ childPage.title }}
                </a>
            </li>
        {% endfor %}

Can you help me to get the childpages from the childpage from the childpage? I hope you know what i mean :-)

Last updated

jan-vince
jan-vince

Classic nesting is not working for you?

Something like:

{% for page in page.getChildren %}

    {% for level1 in page.getChildren %}

        {% for level2 in level1.getChildren %}

            {% for level3 in level2.getChildren %}

            {% endfor %}

        {% endfor %}

    {% endfor %}

{% endfor %}

But using macro for recursion is much more effective!

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.