原文:
Whilstthe 4.4 release predominantly focussed on performance and optimisation,there were a number of other enhancements added to the release (asalways the changelogis the best place to view changes). One of these, that should be ofinterest to skinners and those interested in accessibility standards& xhtml compliance, is support for skin level doctypes .
Historically, if you wanted to target your skin/container for aparticular version of html/xhtml, you had to manually edit thedefault.aspx page to alter the hardcoded DOCTYPE declaration. With 4.4,the declaration has been made dynamic, to allow users to declareparticular doctypes with particular skins. To make use of this, youcreate a file with the same name as your skin except ending indoctype. (rather than ascx/htm/html) and it’ll be picked up duringskin load. This file should contain a single node,SkinDocType, thatcontains a declaration of your desired doctype. To ensure that theparser reads the value correctly, you need to use a CDATA section toescape out the various < and & characters e.g. If I have a skincalled mypage.asx that I intended to render as XHTML 1.0 strict, then Iwould create a file called mypage.doctype. which would contain thefollowing:
<SkinDocType><![CDATA[<!DOCTYPE XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">]]></SkinDocType>
对此John Mitchell认为这个解决方案不灵活,每次页面加载的 解析会降低效率,他提出的解决方案如下:
原文:
Brand new in DNN 4.4 is the option to change your Doctype which Cathal blogged about.
As Cathal pointed out in this thread theimplementation will need to be improved for performance because onevery request the DNN work is looking for an file and loadingit into an Document to validate the .
There is also concern that it is hard to implement with multipleskins because you would need a different file for every Skin.
You can shortcut all of this now and not take the performance hit by using the code below.
Just copy and paste the following code directly into your HTML or .ASCX skin file.
< runat="server">
Private Sub Page_Load(ByVal sender As System. , ByVal e As System.EventArgs) Handles My .Load
Dim skinDocType as Control = Me.Page.FindControl("skinDocType")
If Not skinDocType is Nothing
CType(skinDocType, System.Web.UI.WebControls.Literal).Text="<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">"
End If
End Sub
</ >时间有限,就不翻译了,贴出来供大家参考。
继续阅读与本文标签相同的文章
-
DNN出错:The compiler failed with error code 1.
2026-05-25栏目: 教程
-
DotNetNuke(DNN)皮肤制作-通过JS文件解决不同IE版本对CSS解释不一致的问题
2026-05-25栏目: 教程
-
DNN(DotNetNuke) Sql Injection 攻击
2026-05-25栏目: 教程
-
团队开发-CodePlex的工作模式和团队协作开发
2026-05-25栏目: 教程
-
8月13日科技联播:英情报局渲染中国5G技术威胁,AI技术能准确识别代码真实作者
2026-05-25栏目: 教程
