1

Is there a method for getting a Structure page’s position in relation to its siblings via Global Variable, etc.? I’m currently building a class management interface for a client, and instead of using Playa to create relationships to “parent” entries, I’m instead using Structure, for ease of use for the client. However, they want to take a tree such as this:

Unit Name

- Task Name
  - Segment Name
  - Segment Name

- Task Name
  - Segment Name
  - Segment Name

As a result, I want to be able to automatically add the task and segment's position in relation to its siblings, so that on the front end, I could display the following tree:

Unit Name

- Task A - Task Name
  - Segment A1 - Segment Name
  - Segment A2 - Segment Name

- Task B - Task Name
  - Segment B1 - Segment Name
  - Segment B2 - Segment Name

The line of thinking will be that the letter for the task will be converted using a string plugin, and then the Segment will use a number, appended to the Task’s letter.

  • Is it the A, A1, A2, B, B1, B2 strings you're looking to generate? So you need to find where you're at in the loop, but because Structure outputs everything, you don't have nested loops to increment through? – Mark J. Reeves Jan 29 '13 at 22:16
  • Mark, that's right. However, I'm not using a loop, because I'm on individual pages for this content, so I need to figure out a way to call up this information. – Christopher Kennedy Jan 29 '13 at 22:18
  • I'm going through options here, and it looks like the Structure Entries Plugin may come to my aid here, and I'll just use it inside of a Stash set. – Christopher Kennedy Jan 29 '13 at 22:25
  • Update: Looks like Structure Entries does not play nicely with what I'm trying to do. And unfortunately, getting/finding support on GetSatisfaction is a bit daunting, as GS handles code snippets poorly. – Christopher Kennedy Jan 29 '13 at 23:19
1

I had the crazy idea to assign entries to Structure pages so they could be associated with multiple pages like...Categories. Jack McDade helped with a Structure Categories plugin, and he ended up putting together some code that let me do Level 1, Level 2, etc cases so that I could format nested nav chunks distinctly. I can share that or point you to Jack if you'd like to go that route. Not sure it would do the loop, but Jack might be able to sort that out for you.

Clarification: Jack created some custom Structure tags for us that let us nest Structure tags at each level, to format nested output specifically for each level. I'm suggesting you book him to address your goals and enable you to work in a loop with custom output.

| improve this answer | |
  • Can you expound a little bit more on it? I'm not sure I'm grokking you entirely. – Christopher Kennedy Jan 29 '13 at 23:45
  • Ended up actually having to go a different route due to time constraints on this one. The long and short ended up being that the client is now manually entering these values, which is actually preferable, as they have introduced other symbols, and we are rapidly approaching a change set that would not allow a programmatic approach to this problem. – Christopher Kennedy Feb 1 '13 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.