Dynamicweb.Frontend.UrlProviders Namespace : Mapping Class |
Imports Dynamicweb.Extensibility Namespace Frontend.UrlProviders ''' <summary> ''' News item provider ''' </summary> <System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)> <System.ComponentModel.Browsable(False)> < _ AddInName("News items"), _ AddInDescription("Generates urls for News items in the format /News-name.aspx."), _ AddInActive(True), _ AddInGroup("News"), _ AddInTarget("News"), _ AddInTarget("NewsV2"), _ AddInOrder(3) _ > _ Public Class NewsItemProvider Inherits UrlProvider ''' <summary> ''' Gets the mappings of NewdIDs and their URL names. ''' </summary> ''' <returns></returns> Public Overrides Function GetMappings() As System.Collections.Generic.List(Of Mapping) If Base.IsModuleInstalled("NewsV2") OrElse Base.IsModuleInstalled("News") Then 'Placeholder for holding mappings Dim list As New Generic.List(Of UrlProviders.Mapping) 'Retrieve all the NewsID and News names from news table Using dr As IDataReader = Database.CreateDataReader("SELECT NewsID, NewsHeading, NewsMetaURL FROM News") Do While dr.Read 'Use the name of the News item in the URL. Dim urlName As String = Base.ChkString(dr.Item("NewsHeading")) 'See if the news item has an overwritten name for the URL. If Not String.IsNullOrEmpty(Base.ChkString(dr.Item("NewsMetaURL"))) Then urlName = Base.ChkString(dr.Item("NewsMetaURL")) End If 'Create an URL mapping for the querystring parameter NewsId with the value from NewsID column using the urlName as a replacement list.Add(New UrlProviders.Mapping("NewsId", Base.ChkString(dr.Item("NewsID")), urlName)) Loop End Using Return list Else Return Nothing End If End Function End Class End Namespace
System.Object
Dynamicweb.Frontend.UrlProviders.Mapping
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2