New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Get (parent) page order number in template

VIPStephan July 3, 2019 by VIPStephan

So, here’s what I’m trying to do: I have links in my navigation that are supposed to be colored differently, and also, on each of these pages some elements are supposed to be that color (so, basically each page has its own color scheme). I’m trying to implement this as dynamically as possible, so I’m outputting the page order as class name in the navigation, like <li class="page{{order}}"> and am doing the same on the body element in the page template, and I’m using CSS selectors to style the elements, e. g. .page1 {color: green;}. (this way I can rename or re-order pages and the order of the colors would stay the same, which is what I want)

This all works nicely until I have child pages which have their own order numbers, so the order number on the body doesn’t do it anymore. Basically I need to get the parent page’s order number; how would I do that?

Answered by VIPStephan!
>>>>>>> Answered <<<<<<<
2 Replies