Mar 15, 2011 at 5:56 AM
Edited Mar 15, 2011 at 5: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
|