Enhance your multi-portal appearance with separate favicon.ico Shortcut Icon files for each portal. Make the simple core changes below. Tested for DotNetNuke 2.1.2.
For DNN 3, the Core Team included my code - so it's now built in! Isn't Open Source a wonderful thing!
There are two files to change.
In Default.aspx find the lines in red, and add the line in blue as shown...
<asp:placeholder id="CSS" runat="server"></asp:placeholder>
<asp:placeholder id="JC_Favicon" runat="server"></asp:placeholder>
</HEAD>
In Default.aspx.vb find the lines in red near the top of the file, and add the line in blue...
Protected WithEvents SkinPlaceHolder As System.Web.UI.WebControls.PlaceHolder
Protected WithEvents JC_Favicon As System.Web.UI.WebControls.PlaceHolder
...then, near the end of the Page_Init sub, add these blue lines as shown...
' add CSS links
ManageStyleSheets(False)
' add Favicon
ManageFavicon()
' add skin to page
SkinPlaceHolder.Controls.Add(ctlSkin)
...and add these blue lines near the end of the file...
Private Sub ManageFavicon()
Dim objFavicon As Control = Me.FindControl("JC_Favicon")
Dim objLink As HtmlGenericControl
Dim objJC_FaviconCache As String = CType(DataCache.GetCache("JC_Favicon"), String)
If objJC_FaviconCache Is Nothing Then
If File.Exists(Server.MapPath(_portalSettings.UploadDirectory) & "favicon.ico") Then
objJC_FaviconCache = _portalSettings.UploadDirectory & "favicon.ico"
Else
objJC_FaviconCache = ""
End If
DataCache.SetCache("JC_Favicon", objJC_FaviconCache)
End If
If objJC_FaviconCache <> "" Then
objLink = New HtmlGenericControl("LINK")
objLink.Attributes("rel") = "Shortcut Icon"
objLink.Attributes("href") = _portalSettings.UploadDirectory & "favicon.ico"
objFavicon.Controls.Add(objLink)
End If
End Sub
End Class
End NameSpace
Recompile, then you have the facility to place separate favicon.ico files in each site's upload directory !