Jump to content

list the children of the page parent, but not the page itself


DrFux
 Share

Recommended Posts

Sorry for that messy topic title but my problem seems very complicated to describe in so few words.

So here a better description of my issue:

I have a many product detail site under a parent called /overview/. On this product detail site is at the footer a listing of all the others product detail sites including the site itself. (all children of the parent /overview/.

So i have for example:

/overview/test1/

/overview/test2/

/overview/test3/

/overview/test4/

/overview/test5/

My Code look like this at the moment: 

<?php
$overview = $pages->get("/overview/"); 
$overviewchildren = $overview->children("limit=4");

foreach($overviewchildren as $overviewchild) {?>
                
 <a href="<?=$overviewchild->url?>"><?=$overviewchild->title?></a>
                        
<?}?>

Now on the site /overview/test1/ the code list show test1, test2, test3, test4.

But i want that the child on which the user is at the moment dont show up at the list.

So for the site /overview/test2/ the list should show test1, test3, test4 and test5.

I hope you understand my problem , cause im from germany and to describe a php issue in english is very hard for me.

Thanks a lot everybody for helping me.

Link to comment
Share on other sites

$parent = $page->parent;
$current = $page->id;
$overviewchildren = $parent->children("id!=$current, limit=4");

Or maybe

$overviewchildren = $page>siblings("id!=$page, limit=4");

Edit: oh and welcome!

  • Like 4
Link to comment
Share on other sites

  • 9 months later...

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
 Share

×
×
  • Create New...