FuturShoc Posted January 31, 2013 Share Posted January 31, 2013 Can someone suggest a way to get the *level* of a page in the hierarchy? I need to do something different on a page template, IF the page exists at the third level of the page hierarchy. I was hoping for some kind of $page->level() method I could call, but that doesn't seem to exist. Link to comment Share on other sites More sharing options...
ryan Posted January 31, 2013 Share Posted January 31, 2013 How about: $level = count($page->parents); 3 Link to comment Share on other sites More sharing options...
FuturShoc Posted January 31, 2013 Author Share Posted January 31, 2013 Aha! That seems to give us what we need. Thanks, Ryan. Off the cuff, I wouldn't have expected that to work since I see "parents" as however many siblings exist above the current level. But, clearly, the parent/child model doesn't work *quite* like genetics. ;-) Link to comment Share on other sites More sharing options...
ryan Posted February 1, 2013 Share Posted February 1, 2013 Off the cuff, I wouldn't have expected that to work since I see "parents" as however many siblings exist above the current level.But, clearly, the parent/child model doesn't work *quite* like genetics. ;-) A page does not need to have two parents of the same generation like we do. In the case of ProcessWire, all pages are female. 1 Link to comment Share on other sites More sharing options...
Soma Posted February 1, 2013 Share Posted February 1, 2013 Yeah and you can make them look the way you want. Of course for the female users, they're all male. 1 Link to comment Share on other sites More sharing options...
diogo Posted February 1, 2013 Share Posted February 1, 2013 In the case of ProcessWire, all pages are female. Yeah and you can make them look the way you want Is anyone else noticing something wrong with these two statements? 1 Link to comment Share on other sites More sharing options...
JeffS Posted February 2, 2013 Share Posted February 2, 2013 My wife does. 1 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