How can you exclude in the tree menu the subpages of a certain page which is also a subpage?
The folder-structure is like this:
about-us
news
article1
article2
article3 etc.
All the different named articles should be excluded from the tree menu.
My problem is, that Ive already set one subpage only that should be shown:
<?php
// get the first set of subpages which should be used
$subpages = $pages->find('about-us')->children();
// create the snippet beginning with those subpages
snippet('treemenu', array('subpages' => $subpages));
?>
So I want to show the ‘about-us’-subpages without the articles.
i don’t understand what you mean, the thread i linked to was indeed about the tree menu
In that thread was a post describing how to filter out pages based on template (or some other feature unique to them). Something like this:
<?php foreach($subpages->visible()->filterBy('template', '!=', 'newsarticle') as $p): ?>
newsarticle is the name of your news template. See here for more, and the post below at that describes filtering on more then one template if you need to.
But why would you want to find the news page if you don’t want it’s children? Are there other children of about-us whose grandchildren you do want to fetch?
Maybe you can post your complete navigation to make it clearer what you want to do.
‘nachricht’ is the template of all the articles. When I set in ‘news’, which is the name of the page and the template, it worked but the news-page is of course also excluded from the menu.
@texnixe:
I want to exclude all the subpages of ‘news’ from the main (tree) navigation as these pages contain just short messages that are implemented in blog-style. They can contain pictures sometimes, so a structure didn’t work here.
All grandchildren of ‘about-us’ can be excluded from the menu.
Here is the complete folder structure of the site:
home
bewerber
stellenangebote
lohnrechner
downloads-bewerber
unternehmen
personalvermittlung
personalkostenrechner
downloads-unternehmen
about us
news
article1
article2
article3 etc.
contact
The problem I think is that you are being too specific with the $subpages variable. I think really you need every page in the site, except those using the nachright template. Your tree menu should look something like this: