So I'm working on a section which is basically going to list a load of departments, inside of those will have a number of sub pages.
Here is my tree;
So I made a doc type called "BlankFolder" with no template which created my "Departments" node folder
Then I created a "Department" node with a template which is the main departments page.
Inside the Department page I want to list all of the sub pages e.g About the team, support and advice etc on the Department Template.
I got this work for the "Breast Department by using the query builder. but what I dont want to do is keep having to create it manually. So e.g if I created Plastic Surgery as a department and added some sub pages under it all the sub pages under that would automatically get generated.
Remember there is context of what page you're on at the moment.. so you need to say on this "department" page - I want all the children below rather than hardcoding a specific department.
Model is your friend here - it will be the page you're on;
If you need to list these child pages from a page other than a department page then you need to find the department first by traversing up or down the tree to find it (look at AncestorOrSelf and the various related methods to help you from the Model page.
Get a list of sub pages within a folder page node
Hi,
So I'm working on a section which is basically going to list a load of departments, inside of those will have a number of sub pages.
Here is my tree;
So I made a doc type called "BlankFolder" with no template which created my "Departments" node folder
Then I created a "Department" node with a template which is the main departments page.
Inside the Department page I want to list all of the sub pages e.g About the team, support and advice etc on the Department Template.
I got this work for the "Breast Department by using the query builder. but what I dont want to do is keep having to create it manually. So e.g if I created Plastic Surgery as a department and added some sub pages under it all the sub pages under that would automatically get generated.
The above code works for breast department, but how can I tweak it to automatically work for other departments created?
Thanks in advance
var selection = Umbraco.Content(Guid.Parse("e29e2b35-b2e7-4c08-a3b9-18923f79bc2b"))
does that not just become Model? eg the page that I'm currently on (being a department page)
You're nearly there with your logic.
Remember there is context of what page you're on at the moment.. so you need to say on this "department" page - I want all the children below rather than hardcoding a specific department.
Model is your friend here - it will be the page you're on;
If you need to list these child pages from a page other than a department page then you need to find the department first by traversing up or down the tree to find it (look at AncestorOrSelf and the various related methods to help you from the Model page.
HTH
Steve
Thanks guys, great help :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.