HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Get TabId from URLGet TabId from URL
Previous
 
Next
New Post
12/6/2006 8:05 AM
 

 

Ahhh, I see.  Well, here's a little Regex to make your function a one liner:

TabId = Regex.Match(Url, "tabid[=/](\d+)(.*?)", RegexOptions.IgnoreCase).Groups(1).Value


DotNetNuke Modules from Snapsis.com
 
New Post
12/6/2006 8:09 AM
 
Whoa!  Thanks!  That is incredibly kind of you.  I was just looking at the SiteUrl.config file trying to make since of those RegEx examples.  :)

Will that work with both friendly and non-friendly URLs? 

I apologize for having to ask that.  I haven't been able to code since March, so my knowledge on RegEx has diminished a lot.  :(

These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
New Post
12/6/2006 8:34 AM
 

You're welcome Will, my pleasure.

Yes, it will work with both, the [/&] in the Regex is a character class that says "look for a slash or an ampersand right after the tabid.  The \d+ part says look for digits [0-9].

I actually went a little overboard by doing the second backreference group, this one is more to the point:

TabId = Regex.Match(Url, "tabid[=/](\d+)", RegexOptions.IgnoreCase).Groups(1).Value

Here's the full explanation from RegEx Buddy:

Match the characters "tabid" literally «tabid»
Match a single character present in the list "=/" «[=/]»
Match the regular expression below and capture its match into backreference number 1 «(\d+)»
   Match a single digit 0..9 «\d+»
      Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»

 


DotNetNuke Modules from Snapsis.com
 
New Post
12/8/2006 10:36 AM
 
John, Thank you again for your help.  It was more than I expected.  So far, this is working like I wanted.

To everyone else, just in case you are looking to do something similar to what I needed, here is the resulting function:

Private Function GetTabInformation(ByVal TabUrl As String) As DotNetNuke.Entities.Tabs.TabInfo

    TabUrl = TabUrl.ToLower

    Dim _TabId As Integer = 0
    Dim _tc As New DotNetNuke.Entities.Tabs.TabController

    If TabUrl.IndexOf("tabid") > 0 Then

        _TabId = Integer.Parse(Regex.Match(TabUrl, "tabid[=/](\d+)", RegexOptions.IgnoreCase).Groups(1).Value)

        Return _tc.GetTab(_TabId)

    Else

        Return Nothing

    End If

End Function

These are my personal opinions and don't necessarily represent the views and opinions of DotNetNuke Corporation.
Will Strohl
Media Module Team Lead, User Groups Team Lead
Sales Engineer, DotNetNuke Corporation

DotNetNuke Blog | Find a DNN User Group | Media Module
Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Get TabId from URLGet TabId from URL


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me
Charlotte DoDNN

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Exact Target Exec Alert
r2integrated
Telerik JustCode Free

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.