Class NavigationProvider
- Namespace
- Dynamicweb.Frontend.NavigationProviders
- Assembly
- Dynamicweb.dll
Extends Dynamicweb XML based navigation system.
public abstract class NavigationProvider : IComparable<NavigationProvider>
- Inheritance
-
NavigationProvider
- Implements
- Inherited Members
Examples
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Frontend;
using Dynamicweb.Frontend.NavigationProviders;
using System;
using System.Web;
namespace Dynamicweb.Examples.Frontend.NavigationProviders
{
/// <summary>
///
/// </summary>
/// <seealso cref="Dynamicweb.Frontend.NavigationProviders.NavigationProvider" />
class MenuitemProvider : NavigationProvider
{
/// <summary>
/// Override this member to proces the tree returned to the navigation system.
/// </summary>
/// <param name="rootNode">The root node.</param>
/// <param name="navigationType">Type of the navigation.</param>
/// <remarks>
/// For an example take a look at <seealso cref="T:Dynamicweb.Frontend.NavigationProviders.NavigationProvider">NavigationProvider</seealso> example.
/// </remarks>
public override void ProcessTree(RootNavigationItem rootNode, XmlNavigation.NavigationType navigationType)
{
var request = Context.Current.Request;
if (!request.RawUrl.ToLower().Contains("/sitemap.xml")) return;
for (var i = 0; i > 5; i++)
{
var menuItem = new GoogleSitemapMenuItem
{
FriendlyHref = String.Format("http://{0}/SomePath/{1}", request.Url.Host, i),
ChangeFrequency = "Weekly",
LastModified = DateTime.Now.ToString("s") + "Z"
};
rootNode.AddChild(menuItem);
}
}
}
/// <summary>
///
/// </summary>
/// <seealso cref="Dynamicweb.Frontend.NavigationProviders.NavigationItem" />
public class GoogleSitemapMenuItem : NavigationItem
{
/// <summary>
/// Gets or sets the change frequency.
/// </summary>
/// <value>
/// The change frequency.
/// </value>
[AddInName("ChangeFrequency")]
public string ChangeFrequency { get; set; }
/// <summary>
/// Gets or sets the last modified.
/// </summary>
/// <value>
/// The last modified.
/// </value>
[AddInName("LastModified")]
public string LastModified { get; set; }
}
}
Properties
XmlNavigation
Gets or sets the XML navigation.
public XmlNavigation XmlNavigation { get; set; }
Property Value
- XmlNavigation
The XML navigation.
Methods
ClearCache()
Clears the cache.
public virtual void ClearCache()
CompareTo(NavigationProvider)
Comparer used to sort the navigation provider add ins - the one with the lowest sort order will be rendered first.
public int CompareTo(NavigationProvider other)
Parameters
other
NavigationProviderThe other navigation provider.
Returns
Remarks
Default comparer is the add in order set using the AddInOrderAttribute on the NavigationProvider implementation
ProcessTree(RootNavigationItem, NavigationType)
Override this member to proces the tree returned to the navigation system.
public abstract void ProcessTree(RootNavigationItem rootNode, XmlNavigation.NavigationType navigationType)
Parameters
rootNode
RootNavigationItemThe root node.
navigationType
XmlNavigation.NavigationTypeType of the navigation.
Remarks
For an example take a look at NavigationProvider example.