Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityCommunity Membe...Community Membe...Friendlier Url Provider v1.0.3Friendlier Url Provider v1.0.3
Previous
 
Next
New Post
10/17/2008 3:40 PM
 

version 1.0.3 comes with a few bug fixes, and new cool features, such as environment token support, and dynamic regex variables.

Feel free to download the trial version.

Our module gives full control over the mapping between real and rewritten urls. You define rules made of a customizable vocabulary.

Bringing Friendly Urls to any existing module only requires you to build your own vocabulary with a few lines of code.

 

Here's a sample implementation for the Dnn forum:

You can see the result on our website. Simply compare the Urls to what you normally get on the dotnetnuke.com forums, and now look what it took to make it.

You only need to declare the new vocabulary you wish to consume and provide corresponding "rewrites".

 

Public Class DnnForumUrlRewriter
        Implements IUrlRewriterProvider

        Public Function GetModuleRewrites() As System.Collections.Generic.List(Of GroupParamsRewrite) Implements IUrlRewriterProvider.GetRewrites
            Dim toReturn As New List(Of GroupParamsRewrite)
            toReturn.Add(New GroupParamsRewrite("GroupName", RewriteType.SubPath, UrlParam.FromSyntax("groupid")))
            toReturn.Add(New GroupParamsRewrite("ForumName", RewriteType.SubPath, UrlParam.FromSyntax("forumid")))
            toReturn.Add(New GroupParamsRewrite("ThreadName", RewriteType.SubPath, UrlParam.FromSyntax("threadid")))
            Return toReturn
        End Function

        Public Function RewriteParams(ByVal groupName As String, ByVal objRewriteType As RewriteType, ByVal params As System.Collections.Generic.Dictionary(Of UrlParam, String)) As GroupRewriteResult Implements IUrlRewriterProvider.RewriteParams
            Dim toReturn As New GroupRewriteResult()

            If params.Count > 0 Then
                Select Case groupName.ToLowerInvariant
                    Case "groupname"
                        Dim groupeId As Integer = Integer.Parse(params(UrlParam.FromSyntax("groupid")), CultureInfo.InvariantCulture)
                        toReturn.RewriteValue = GetGroupName(groupeId)
                        toReturn.ConsumedParameters(UrlParam.FromSyntax("groupid")) = True
                    Case "forumname"
                        Dim forumId As Integer = Integer.Parse(params(UrlParam.FromSyntax("forumid")), CultureInfo.InvariantCulture)
                        toReturn.RewriteValue = GetForumName(forumId)
                        toReturn.ConsumedParameters(UrlParam.FromSyntax("forumid")) = True
                    Case "threadname"
                        Dim threadId As Integer = Integer.Parse(params(UrlParam.FromSyntax("threadid")), CultureInfo.InvariantCulture)
                        toReturn.RewriteValue = GetThreadName(threadId)
                        toReturn.ConsumedParameters(UrlParam.FromSyntax("threadid")) = True
                End Select
            End If
            Return toReturn
        End Function

        Public Function GetGroupName(ByVal groupeId As Integer) As String
            Dim gc As New DotNetNuke.Modules.Forum.GroupController
            Dim GroupInf As DotNetNuke.Modules.Forum.GroupInfo = gc.GroupGet(groupeId)
            Dim toReturn As String = String.Empty
            If GroupInf IsNot Nothing Then
                toReturn = GroupInf.Name
            End If
            Return StringEscaper.EscapeString(toReturn, 45)
        End Function

        Public Function GetForumName(ByVal forumId As Integer) As String
            Dim fc As New DotNetNuke.Modules.Forum.ForumController
            Dim ForumInf As DotNetNuke.Modules.Forum.ForumInfo = fc.GetForum(forumId)
            Dim toReturn As String = String.Empty
            If ForumInf IsNot Nothing Then
                toReturn = ForumInf.Name
            Else
                toReturn = forumId
            End If
            Return StringEscaper.EscapeString(toReturn, 45)
        End Function

        Public Function GetThreadName(ByVal threadId As Integer) As String
            Dim tc As New DotNetNuke.Modules.Forum.ThreadController
            Dim ThreadInf As DotNetNuke.Modules.Forum.ThreadInfo = tc.ThreadGet(threadId)
            Dim toReturn As String = String.Empty
            If ThreadInf IsNot Nothing Then
                toReturn = ThreadInf.Subject
            End If
            Return StringEscaper.EscapeString(toReturn, 45)
        End Function

    End Class

 

Now here 's the rule associated to our forum: The new vocabulary is instantly available in your specific pattern.

 

[${Scheme}][${RootPath}][/${Language}][/${TabPath}][/${TabName}][/${ModuleTitle}][/${groupname}][/${forumname}][/${threadname}][/${threadpage}][/${postid}][/${scope}][/${action}][/${ControlKey}][/${Params,SubPath}][.${Extension}][?${QueryString,QueryStringValue}]


Jesse
CTO - Aricie
 
New Post
10/19/2008 11:32 AM
 

A sample provider to a 3rd party module is also illustrated with Ventrian's Newsarticle.

The provider is discussed and exhibited on Scott's Forum, and demonstrated on our website. It is included by default together with core Forum and Wiki implementations in the trial and regular PAs.

Edit: the wiki is demonstrated there (French DNN Guide).


Jesse
CTO - Aricie
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityCommunity Membe...Community Membe...Friendlier Url Provider v1.0.3Friendlier Url Provider v1.0.3


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out