设为首页
加入收藏
站内地图
旧版入口
当前位置:首页 > 站长学院 > 网络编程 > ASP

aspTemplate : 类似 phpLib::Template 的分离层实现

作者:佚名 出处:网络转载 时间:04-26 点击:

内容载入中...
MVC 模式在网站架构中十分常见。它允许我们建立一个三层结构的应用程式,从代码中分离出有用的层,帮助设计师和开发者协同工作以及提高我们维护和扩展既有程式的能力。
    PHP 中有一个很著名的类库 phpLib,其中有 Template 模板类。能够很方便地实现代码分离在 ASP 中是否也可以这样做呢?当然可以,这就是 aspTemplate 的初衷。它完全实现了 phpLib Template 的全部功能,你可以象使用 phpLib Template 一样使用它,连习惯也基本不用改。:)

<%

'#######################################################################
'## NAME:  aspTemplate
'## BY:   BigHan
'## DATE:  Nov. 28, 2003
'## SITE:  http://aspTemplate.yeah.net/
'## EMAIL:  aspTemplate@21cn.com
'##
'## (C) Copyright 2003-2004 bighan
'#######################################################################

 

Class aspTemplate

 '####
 '## name of this class
 '## var string
 '## @access    Private
 '## @see       property: Name
 '####
 Private m_strName

 '####
 '## version of this class
 '## var string
 '## @access    Private
 '## @see       property: Version
 '####
 Private m_strVersion

 '####
 '## Determines how much debugging output Template will produce.
 '## This is a bitwise mask of available debug levels:
 '## 0 = no debugging
 '## 1 = debug variable assignments
 '## 2 = debug calls to get variable
 '## 4 = debug internals (outputs all function calls with parameters).
 '##
 '## @var       int
 '## @access    Private
 '## @see       property: Debug
 '####
 Private m_intDebug

 '####
 '## The base directory from which template files are loaded.
 '##
 '## @var       string
 '## @access    private
 '## @see       property: Root, Dir; method: SetRoot, set_root
 '####
 Private m_strRoot

 '####
 '## Determines how to output variable tags with no assigned value in templates.
 '##
 '## @var       string
 '## @access    private
 '## @see       property Unknown; method: SetUnknowns, set_unknowns
 '####
 Private m_strUnknowns

 '####
 '## Determines how Template handles error conditions.
 '## "yes"      = the error is reported, then execution is halted
 '## "report"   = the error is reported, then execution continues by returning "false"
 '## "no"       = errors are silently ignored, and execution resumes reporting "false"
 '##
 '## @var       string
 '## @access    private
 '## @see       property IsHalt; method: halt
 '####
 Private m_strHaltError

 '####
 '## The last error message is retained in this variable.
 '##
 '## @var       string
 '## @access    private
 '## @see       property LastError
 '##
 Private m_strLastError

 '####
 '## Opening delimiter (usually "{")
 '##
 '## @var       string
 '## @access    private
 '## @see       property BeginTag
 '####
 Private m_strBeginTag

 '####
 '## Closing delimiter (usually "}")
 '##
 '## @var       string
 '## @access    private
 '## @see       private EndTag
 '####
 Private m_strEndTag

 '####
 '## A hash of strings forming a translation table which translates variable names
 '## into names of files containing the variable content.
 '## m_oFile.Item(varname) = "filename";
 '##
 '## @var       object
 '## @access    private
 '## @see       method: SetFile, SetFiles, set_file
 '####
 Private m_oFile

 '####
 '## Regular Expression Object
 '##
 '## @var       object
 '## @access    private
 '####
 Private m_oRegExp

 '####
 '## A hash of strings forming a translation table which translates variable names
document.getElementById('loading').style.display="none";

收藏本文:
】【打印页面】【推荐给朋友】【关闭窗口

站长学院

推荐信息