Supporting meta values containing commas

Mar 15, 2011 at 6:56 AM
Edited Mar 15, 2011 at 6:57 AM

In some contexts it is desirable to dynamically insert a meta tag who's value contains a comma. For example, when using the viewport meta tag to control the layout on mobile devices.

Currently the stylehelper skin object is not set up to do that. I've modified a copy of it to delimit on pipes rather than commas to support this functionality:

Private Sub ProcessMetaTags()   'Process meta tags to add to the head
    If Not AddMetaTags.Trim = String.Empty Then
        For Each s As String In AddMetaTags.Split("|")
            Dim i As Integer = s.LastIndexOf(":")
            WriteMeta(s.Substring(0, i).Trim, s.Substring(i + 1).Trim)
        Next
    End If
End Sub

With this, you can do the following:

<%@ Register TagPrefix="fortyfingers" TagName="STYLEHELPER" Src="~/DesktopModules/40Fingers/SkinObjects/StyleHelper/StyleHelper.ascx" %>
<fortyfingers:STYLEHELPER AddMetaTags="viewport:width=device-width, initial-scale=1, maximum-scale=1|something:else-entirely" runat="server" />

Which generates:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="something" content="else-entirely" />

Ian

Coordinator
Mar 15, 2011 at 6:41 PM

Ian you are right, thanks.

I logged the same issue here:

http://dnnskinextensions.codeplex.com/workitem/12795

Which is long overdue...

But I didn't incorporate it yet, I'll add it in the next version.

 

Mar 15, 2011 at 7:38 PM

Awesome! Guess I should have looked for a logged issue first - glad to hear it'll be in the works!

Take care,

Ian

Coordinator
Mar 15, 2011 at 7:52 PM

Ian, np, it's good to see you paying attention ;-)

New version released (01.08.03), with some other small enhancements.

Timo