各種 Umbraco references指出Umbraco只在umbraco.config中存儲節點createDate和updateDate(當您想要編碼Umbraco內容的xslt轉換時)。Umbraco在xslt中發佈日期
但我需要能夠在xslt轉換中顯示發佈日期。
現在工作了,在一把umbraco數據庫cmsContentVersion.VersionDate在節點發布日期和cmdDocument.updateDate是最後的更新日期,我可以創造改變updateDate匹配每當每當發佈日期更改發佈日期後觸發並使用以下xsl:
<xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'd MMM yyyy hh:mm')"/>
但理想情況下,我不想更改核心Umbraco表定義。
我發現this reference這表明延長節點文檔暴露在C#中的發佈日期,使用:
public static string ReleaseDate(int nodeId) {
Document d = new Document(nodeId);
return d.ReleaseDate.ToString();
}
...但我怎麼翻譯的XSLT是C#?將xslt重寫爲ascx宏不是一個選項。
請注意,通過使用Document API,您將在每次獲取發佈日期時擊中數據庫,這會影響性能。有關更多詳細信息,請參閱[節點和文檔之間的區別](http://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-document)。 – JMason