I can't be the only one who needs to create a fixed global navigation menu at the top of the page that contains links to existing pages in the site that are included in the primary navigation tree, as well as specified external links - right?
This probably won't make sense but I have spent 3 solid days trying to get the Multi-URL Picker (RJP) to work. I have my primary navigation all working correctly based on how the pages are arranged in the content window, but I basically need another menu at the top of the page where the user can specify the links to go in there - not dependent on the structure in the content window.
The Multi-URL works if I have a new Document Type and I put in some urls, then browse to "/top-nav-links", but if I try to include this like a partial I get a runtime error, if I try to copy out the code that is working for it to display the links on a new page I get a runtime error, and if I go custom and try to go down the new root node and find this field I get runtime errors.
This is the current structure:
Section I
--Secondary I
----Tertiary I
--Secondary II
----Tertiary II
Section II
--Secondary
----Tertiary
Top Nav Links
Any ideas on how I can have a root node document that contains the "linkPicker" in it (Top Nav Links), then get the url for each of the links to display globally across each section, secondary, and tertiary page?
It sounds like that's the same way I'm trying to do it. I am able to search through the root nodes and get the one that has the MultiUrlPicker in it (both by Id or but checking of the property is there), but then I'm stuck trying to get the values from the picker. Lots of yellow error screens as I try to work though it! How are you getting back the links and page name from the picker?
This is my first time working with Umbraco so I'm learning on the fly. I have a not-as-elegant solution in place now where the user can select a checkbox on any page to add it to the global mac and then put in a number to have the links sorted that way. It would be much easier to use the picker though!
Would you be able to share how you're getting the values back from the picker?
Unfortunately neither of those examples have worked with rendering the list in a different node which is leaving me scratching my head. The dynamic example doesn't work at all, even when viewing the actual page where the picker is added.
If I add the Multi Url Picker type to a document type, let's say "Top Nav Links" per the structure above, and use the example with var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("topBarLinks"); I get the list output at domain.local/top-nav-links no problem. If I use the dynamic example, nothing renders at all.
So using the Typed way, if I then try to use that code within a partial after getting the node that contains the picker, I always get an error of:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
This highlights the line if (multiUrlPicker.Any()) as the problem. If I remove the if statement, I'll still get the same exception error but this time referencing the @foreach (var item in multiUrlPicker) line.
I've already removed all of the code in order to implement my other solution (and to keep it from erroring) so I could move on and revisit this after.
I believe I was using uQuery to get the node that has the picker in it (var topLinkMenu = uQuery.GetNodesByName("Top Navigation Links");) but trying to do it that way again now I can't use .GetProperty/.HasProperty/.GetPropertyValue, etc. to find the picker.
This is the view that does work, per the example, rendering the links at domain.local/top-navigation-links:
I was able to dig deeper based on your last reply and finally have it working! I had to set the topBarItemsNode to siteRoot.Where("DocumentTypeAlias == \"TopNavigationLinks\"").FirstOrDefault();
In the end, this is what ended up working based on your input:
Multi URL Picker global navigation in Umbraco 7
I can't be the only one who needs to create a fixed global navigation menu at the top of the page that contains links to existing pages in the site that are included in the primary navigation tree, as well as specified external links - right?
This probably won't make sense but I have spent 3 solid days trying to get the Multi-URL Picker (RJP) to work. I have my primary navigation all working correctly based on how the pages are arranged in the content window, but I basically need another menu at the top of the page where the user can specify the links to go in there - not dependent on the structure in the content window.
The Multi-URL works if I have a new Document Type and I put in some urls, then browse to "/top-nav-links", but if I try to include this like a partial I get a runtime error, if I try to copy out the code that is working for it to display the links on a new page I get a runtime error, and if I go custom and try to go down the new root node and find this field I get runtime errors.
This is the current structure:
Any ideas on how I can have a root node document that contains the "linkPicker" in it (Top Nav Links), then get the url for each of the links to display globally across each section, secondary, and tertiary page?
Thanks!
Hi Chad,
We build this kind of functionality a lot in our sites.
What we mostly do is add a MultiUrlPicker property to the homepage or settings node where the editor can pick the items for the fixed menu.
Then in our views we look up the homepage/settings node and render the picked links from the property
Dave
Hi Dave,
It sounds like that's the same way I'm trying to do it. I am able to search through the root nodes and get the one that has the MultiUrlPicker in it (both by Id or but checking of the property is there), but then I'm stuck trying to get the values from the picker. Lots of yellow error screens as I try to work though it! How are you getting back the links and page name from the picker?
This is my first time working with Umbraco so I'm learning on the fly. I have a not-as-elegant solution in place now where the user can select a checkbox on any page to add it to the global mac and then put in a number to have the links sorted that way. It would be much easier to use the picker though!
Would you be able to share how you're getting the values back from the picker?
Hi Chad,
On the github page of the package are some code examples. Both using strongly typed IPublishedContent or a dynamic variant
https://github.com/rasmusjp/umbraco-multi-url-picker/
Dave
Unfortunately neither of those examples have worked with rendering the list in a different node which is leaving me scratching my head. The dynamic example doesn't work at all, even when viewing the actual page where the picker is added.
If I add the Multi Url Picker type to a document type, let's say "Top Nav Links" per the structure above, and use the example with
var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("topBarLinks");
I get the list output at domain.local/top-nav-links no problem. If I use the dynamic example, nothing renders at all.So using the Typed way, if I then try to use that code within a partial after getting the node that contains the picker, I always get an error of:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
This highlights the line if (multiUrlPicker.Any()) as the problem. If I remove the if statement, I'll still get the same exception error but this time referencing the @foreach (var item in multiUrlPicker) line.
Am I way off base on this?
Can you post your entire code of the partial ? This will help in finding the problem
Dave
Hey Dave,
I've already removed all of the code in order to implement my other solution (and to keep it from erroring) so I could move on and revisit this after.
I believe I was using uQuery to get the node that has the picker in it (var topLinkMenu = uQuery.GetNodesByName("Top Navigation Links");) but trying to do it that way again now I can't use .GetProperty/.HasProperty/.GetPropertyValue, etc. to find the picker.
This is the view that does work, per the example, rendering the links at domain.local/top-navigation-links:
This is the partial where I need to get the menu to render (my current alternate way of listing items is commented out):
Probably you can do something like this.
Mind this code is written in this blog post and not test so it can contain errors.
Dave
Dave,
I was able to dig deeper based on your last reply and finally have it working! I had to set the topBarItemsNode to
siteRoot.Where("DocumentTypeAlias == \"TopNavigationLinks\"").FirstOrDefault();
In the end, this is what ended up working based on your input:
Thank you for your guidance!
Glad you sorted it out. Don't forget to mark this post as solved so others can find the solution as well.
Dave
is working on a reply...