您的位置:首页 > 其它

dasBlog的模板引擎(一)-----概念解释

2006-03-29 13:01 197 查看
dasBlog有自己的一套模板引擎,最近研究了它的模版引擎的实现.

先解释一下跟它的模板引擎相关的两个概念。

Theme(主题):就是一套模版,包括所有界面。包括以下几个文件:

template:暂时不知在何处使用(可能在当前版本中并未使用)

hometemplate:首页界面

destopWebsitetmeplate:也是不知在何处使用(可能在当前版本中并未使用)

itemTemplate:单个文章显示模板

dataTemplate:以天为单位的文章列表显示模板

Macros(宏):一个模版页是由多个宏还有一些其它的HTML代码组成的。以下列举了一些宏及其作用

<%BlogStats%>:Blog状态

<%FrontPageTitleList%>:首页文章标题列表

<%PopularList(int numEntiries, int maxLength)%>:最受欢迎文章列表,可传入相应的参数

<%newtelligence.search()%>:搜索框

<%newtelligence.aspnetcontrol("themecombo.ascx")%>:主题转换的ComboBox,可以显示任何一个用户控件

从以上的几个宏,我们可以看到dasBlog的宏功能是很强大的.

以下是一个itemTemplate文件的示例:

<div class="item">
<div class="itemTitle">
<img src="images/array.gif" onclick="{if((document.getElementById('<%ItemGuid%>')).style.display=='none') {(document.getElementById('<%ItemGuid%>')).style.display='block'; this.src='images/array.gif'} else {(document.getElementById('<%ItemGuid%>')).style.display='none'; this.src='images/array_2.gif'}}" />
<%ItemTitle%></div>
<div class="itemContents">
<div class="itemBody" id="<%ItemGuid%>"><%ItemBody%></div>
<div class="categoryLinks"><%categoryLinks%></div>
<div class="itemFooter">
posted on <%when%> 
<a href="javascript:d=document;t=d.selection?(d.selection.type!='None'?
d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');
void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit',
'scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();"
title="Store it to 365Key">365Key</a> 
<%permalink%> 
<%editButton%> 
<%commentLink%>
<%trackbackLink%><br>
<%RelatedPostList%>
<%trackbackList%>
<%ReferralList%>
<%enclosure%>
</div>
</div>
</div>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: