原本使用Word进行编辑Blog的操作,最近发现显示风格比较难看,主要是Word中的编辑功能太强导致,所以现在就回到使用Live Writer了,简单实用啊。
大家都晓得吧,这个站点是使用的http://www.dotnetblogengine.net/这个站点所提供的基于Asp.Net2技术的单人Blog引擎制作而成,我基本保持了代码的原貌,对功能进行了扩充,呵呵,只有我自己才能用到这些功能。
如果您也想部署这个东西,有几个地方可能需要修改方能适用于中文环境
1、修改AppCode/PostCalendar.cs文件,适应中文的星期几
修改函数protected override void OnPreRender(EventArgs e)为如下版本
1: protected override void OnPreRender(EventArgs e)
2: {
3: if (!Page.IsCallback && !Page.IsPostBack)
4: base.VisibleDate = DateTime.Now;
5:
6: if (!Page.IsPostBack && Context.Request.QueryString["date"] != null)
7: {
8: DateTime date = DateTime.Now;
9: if (DateTime.TryParse(Context.Request.QueryString["date"], out date))
10: base.VisibleDate = date;
11: }
12:
13: base.OnPreRender(e);
14: if (!ShowPostTitles)
15: ShowTitle = false;
16: Thread threadCurrent = Thread.CurrentThread;
17: System.Globalization.CultureInfo ciNew = (System.Globalization.CultureInfo)threadCurrent.CurrentCulture.Clone();
18: ciNew.DateTimeFormat.DayNames = new string[] { "日", "一", "二", "三", "四", "五", "六" };
19: ciNew.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday;
20: threadCurrent.CurrentCulture = ciNew;
21: }
其中第16行开始为新增的代码,需要添加一个引用using System.Threading;
再修改我们实用PostCalendar的地方
1: <blog:postcalendar ID="Postcalendar1" runat="Server" nextmonthtext=">>" daynameformat="Full"
2: firstdayofweek="monday" prevmonthtext="<<" cssclass="calendar" borderwidth="0"
3: weekenddaystyle-cssclass="weekend" othermonthdaystyle-cssclass="other" useaccessibleheader="true"
4: enableviewstate="false" />
修改daynameformat的值为full,这样就可以得到正确的日期显示。
2、对于本站当前使用的Theme SilverLight,如果您也需要使用,那么需要做如下修改才能适合中国人用
在content.css中修改字体大小从70%修改成80%
1: /* (en) base layout gets standard font size 12px */
2: /* (de) Basis-Layout erhält Standardschriftgröße von 12 Pixeln */
3: body
4: {
5: font-family: Arial, Verdana;
6: font-size: 80.00%;
7: color: #444444;
8: }
修改同一个文件中的header.p的设置,从left修改称为padding-left否则在IE7中会出现横向滚动条
1: #header p
2: {
3: position: relative;
4: color: #444444;
5: padding-left: 77px;
6: top: 27px;
7: font-size: 15px;
8: font-weight: bold;
9: }
真是感谢上帝,让我现在使用了Firefox下的鼎鼎大名的FireBug,否则我真不知何从查起——Web Developer for IE?请原谅我的坦率,火星了吧你!
对于这个模板,偶多说两句,这个模板是支持浮动宽度的,在basemod.css中设置page_margins的宽度即可,我设置为97%,嘿嘿。设置栏目的宽度则需要修改col1,col2和col3,我删除了col3的显示,设置如下
1: #col1
2: {
3: float: left;
4: width: 200px;
5: margin: 0;
6: }
7: #col2
8: {
9: float: right;
10: width: 190px;
11: margin: 0;
12: }
13: #col3
14: {
15: width: auto;
16: margin: 0 2px 0 200px;
17: }
这个模板使用了著名的CSS框架 yaml,一句话,山高仰止啊。
这个模板有一个缺陷,在IE6下面显示的菜单存在问题
菜单线条越界了。
3、删除在回复评论的时候输入框下面的那个讨厌的工具条,
在UserControl/CommentView.ascx.cs中删除以下代码
1: <%
1: if (BlogSettings.Instance.IsCoCommentEnabled){
%>
2: <script type="text/javascript">
1:
2: // this ensures coComment gets the correct values
3: coco =
4: {
5: tool : "BlogEngine",
6: siteurl : "<%=Utils.AbsoluteWebRoot %>",
7: sitetitle : "<%=BlogSettings.Instance.Name %>",
8: pageurl : "<%=Request.Url %>",
9: pagetitle : "<%=this.Post.Title %>",
10: author : "<%=this.Post.Title %>",
11: formID : "<%=Page.Form.ClientID %>",
12: textareaID : "<%=txtContent.UniqueID %>",
13: buttonID : "<%=btnSave.ClientID %>"
14: }
</script>
1:
2: <script id="cocomment-fetchlet" src="http://www.cocomment.com/js/enabler.js" type="text/javascript">
</script>
这段代码中有个开关量,我懒得设置了,一并干掉。