ASP 高级模板引擎实现类

论坛 期权论坛     
niminba   2021-5-22 22:19   97   0
<div class="codetitle"><span><a class="copybut" data="90057" id="copybut90057"><u>复制代码</u></a></span> 代码如下:</div><div class="codebody" id="code90057"><br>Class template <br><br>&nbsp;&nbsp;&nbsp;&nbsp;Private c_Char, c_Path, c_FileName, c_Content, c_PageUrl, c_CurrentPage, c_PageStr, ReplacePageStr <br>&nbsp;&nbsp;&nbsp;&nbsp;Private TagName <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;设置编码 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Let Char(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_Char = Str <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get Char <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Char = c_Char <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;设置模板文件夹路径 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Let Path(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_Path = Str <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get Path <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Path = c_Path <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;设置模板文件名 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Let FileName(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_FileName = Str <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get FileName <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FileName = c_FileName <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;获得模板文件具体路径 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get FilePath <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Len(Path) &gt; 0 Then Path = Replace(Path, "\", "/") <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Right(Path, 1) &lt;&gt; "/" Then Path = Path &amp; "/" <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FilePath = Path &amp; FileName <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;设置分页URL <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Let PageUrl(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_PageUrl = Str <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get PageUrl <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PageUrl = c_PageUrl <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;设置分页 当前页 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Let CurrentPage(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_CurrentPage = Str <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get CurrentPage <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CurrentPage = c_CurrentPage <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;输出内容 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Public Property Get Flush <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(c_Content) <br>&nbsp;&nbsp;&nbsp;&nbsp;End Property <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;类初始化 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Private Sub Class_Initialize <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TagName = "pjblog" <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_Char = "UTF-8" <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReplacePageStr = Array("", "") <br>&nbsp;&nbsp;&nbsp;&nbsp;End Sub <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;过滤冲突字符 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Private Function doQuote(ByVal Str) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doQuote = Replace(Str, Chr(34), """) <br>&nbsp;&nbsp;&nbsp;&nbsp;End Function <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;类终结 <br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;Private Sub Class_Terminate <br>&nbsp;&nbsp;&nbsp;&nbsp;End Sub <br><br>&nbsp;&nbsp;&nbsp;&nbsp;' *************************************** <br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;&nbsp;&nbsp;加载文件方法 <br
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:1060120
帖子:212021
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP