Search the Community
Showing results for tags 'sibling'.
-
My site structure is something like this: parent item 1 --sibling --sibling --sibling --sibling parent item 2 parent item 3 Within parent item 1, I have a menu that navigates to each sibling page like this: <nav> <ul id="pages"> <li><a class="previous" href="<?php echo $page->prev->path; ?>">prev</a></li> <li><a class="next" href="<?php echo $page->next->path; ?>">next</a></li> </ul> </nav> What I would like to do is change my li class when ever a user would get to the first and last sibling page. Does anyone know how I can do that?
-
Sorry, should be something basic but can't seem to find the answer in here. If I want a section with a header ie: (Other news articles) to display only if the page has siblings, how would I go about checking that in an if statement? I have tried: if ($page->siblings) if ($page->siblings()) if ($page->siblings->id) if ($page->siblings.count > 0) I find myself always guessing at the different ways on testing whether or not something is empty or does not exist. Is there a general rule? This might help me clarify when to use which of the above! Thanks guys.
-
Was just wondering about the best way to show a list of siblings (in this case other news articles) in the sidebar without also showing the current page article? Currently I have this but not sure on how to "offset" the current page: <?php $siblings = $page->siblings(); foreach ($siblings as $sibling) { ?> <li><a href="<?php echo $sibling->url; ?>"><?php echo $sibling->title; ?></a></li> <?php } ?>