Manaus Posted June 5, 2014 Share Posted June 5, 2014 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! Link to comment Share on other sites More sharing options...
Macrura Posted June 5, 2014 Share Posted June 5, 2014 $blue = $pages->get('name=blue'); 1 Link to comment Share on other sites More sharing options...
Manaus Posted June 5, 2014 Author Share Posted June 5, 2014 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. Link to comment Share on other sites More sharing options...
owzim Posted June 5, 2014 Share Posted June 5, 2014 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? Link to comment Share on other sites More sharing options...
Soma Posted June 5, 2014 Share Posted June 5, 2014 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. 3 Link to comment Share on other sites More sharing options...
owzim Posted June 5, 2014 Share Posted June 5, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now