Jump to content

Recommended Posts

Posted

Hello, I have a site hyerarchy like this:

/projects/blue/

/projects/blue/posts/

/projects/blue/posts/comments/

How can I get always 'blue', wherever I am? Mind that I have many colors...

Thanks!

Posted

Thanks Macrura, I only wish it was so easy...
The script is in a code I include in many pages, so it's highly dynamic
 
I tried $page->rootParent->child, but I get the first element of the array, which is always blue.

Posted

How can I get always 'blue', wherever I am? Mind that I have many colors...

I tried $page->rootParent->child, but I get the first element of the array, which is always blue.

First you always want to get blue and then you don't want to always get blue. Can you please give more detail on what you actually want to achieve?

Posted

Use parents() or closest(). If those color pages have a own template use that in the selector for closest() or parents(). Or parents()->eq(n) where n is the level of color pages.

  • Like 3
Posted

Use parents() or closest(). If those color pages have a own template use that in the selector for closest() or parents(). Or parents()->eq(n) where n is the level of color pages.

Uhh, closest, I love that method, I use it in jQuery very frequently.

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
  • Recently Browsing   0 members

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