Ideally with the option to pick which page to display and which ones not to display. Am still new to razor so this has total gone over me lol. I no its a weird structure but my client wants it that way, basically to separate shop pages, blog pages and the main sites pages. I am using one main master page which all of these pages feed into and at the moment can only resort to having a hardcoded list. THANKS IN ADVANCE.
thanks for the reply, i have added that property and selected it on the pages i want displayed and unfortunately i still cant pick up all the pages. if im on the home page i cant pick up anything including the home page itself and when im on 1 of the pages e.g. page 3 (from above) i can only get page 3 and 4 with that property selected and not the home page or page 5. i have stripped my razor script to the one bellow, just to get the pages and put them in a list.
ye it is sort, take it from yo example above the home page and about page are both level 1. I f so then ye it is and when im on about/page1 can get page 2 as wel but when im on home and home/page1 can only get home and not about/page1 as well as about/page2. looks like am jus gona have to try and put all the pages under the home page which is what i already had until my client went on to create a lot of new pages on the same level as the home pages lol.
Main Navigation with nodes on same level as home page and bellow
Hi guys
I have this structure for my site,
Home
page 1
page 2
Another level 1 page 1
page 3
page 4
Another level 1 page 2
page 5
page 6
I am trying to create a main navigation can list all the pages regardless on which page you are on and on what level e.g.
home, page 1, page 2, Another level1 page1, page 3, page 6
Ideally with the option to pick which page to display and which ones not to display. Am still new to razor so this has total gone over me lol. I no its a weird structure but my client wants it that way, basically to separate shop pages, blog pages and the main sites pages. I am using one main master page which all of these pages feed into and at the moment can only resort to having a hardcoded list. THANKS IN ADVANCE.
Denford
Hii Denford.
You can add property with alias for exam - showOnMainMenu of type true / false
Then you can run trow all of your pages with that property like this:
Hope that help.
Cheers
hi mate,
thanks for the reply, i have added that property and selected it on the pages i want displayed and unfortunately i still cant pick up all the pages. if im on the home page i cant pick up anything including the home page itself and when im on 1 of the pages e.g. page 3 (from above) i can only get page 3 and 4 with that property selected and not the home page or page 5. i have stripped my razor script to the one bellow, just to get the pages and put them in a list.
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.MacroEngines;
@using System.Linq;
@using System.Xml.Linq
@using System.Collections.Generic;
@{
<ul>
@foreach (var item in Model.AncestorOrSelf ().Descendants ().Where ("showOnMainMenu"))
{
<li>
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
}
Your struct should be look like this :
--Site setting
---- Home
---- About
------- page 1
------- page 2
then AncestorOrSelf () go to Site setting node from any page. - and Model.AncestorOrSelf ().Descendants () run trow all pages.
you could also then get general propeerties like : Model.AncestorOrSelf ().propertyAlias
ye it is sort, take it from yo example above the home page and about page are both level 1. I f so then ye it is and when im on about/page1 can get page 2 as wel but when im on home and home/page1 can only get home and not about/page1 as well as about/page2. looks like am jus gona have to try and put all the pages under the home page which is what i already had until my client went on to create a lot of new pages on the same level as the home pages lol.
hi guys have worked a way round it, have used uquery's property @uQuery.GetRootNode(); then looped through the children.
is working on a reply...