我正在使用SharePoint 2013團隊網站。而在我的seatle.master頁我已經定義如下: -顯示我的SharePoint主頁面中的當前年份
<div id="customFooter" class="noindex">© .. Group 2013</div>
,但我不知道是否有從我的母版頁訪問Date對象的方式,然後顯示當前的年,而不是手寫打字的一年。這將需要稍後更新一年。 感謝
我正在使用SharePoint 2013團隊網站。而在我的seatle.master頁我已經定義如下: -顯示我的SharePoint主頁面中的當前年份
<div id="customFooter" class="noindex">© .. Group 2013</div>
,但我不知道是否有從我的母版頁訪問Date對象的方式,然後顯示當前的年,而不是手寫打字的一年。這將需要稍後更新一年。 感謝
試試這個
<div id="customFooter" class="noindex">
© .. Group <%=DateTime.Now.Year.ToString() %>
</div>
試試這個:
<div id="customFooter" class="noindex"> © .. Group <script type="text/javascript">document.write(new Date().getFullYear());</script> </div>
爲您的建議添加一些更多的細節,使其成爲一個很好的答案 – dbmitch
感謝,但本次上調下面的錯誤。 「對不起,出錯了 處理/discussionforum/GeneralDiscussion/_catalogs/masterpage/Custom.master期間發生錯誤,此文件中不允許有代碼塊。」 –
查看啓用代碼塊的鏈接。 http://blog.bullseyeconsulting.com/archive/2013/03/21/fixing-code-blocks-not-allowed.aspx http://www.codeproject.com/Articles/120190/How-to-enable-code -blocks-in-Sharepoint-2010-Works – Dale
但使用PageParserPath將導致性能問題! http://support.microsoft.com/kb/2659203 –