Download it: ASPC 1.1 beta (zip)
From a tool compiling ASP pages to COM DLLs ASP Compiler evolves to a new level. Now it
becomes a flexible programming environment which could be extended by the developers to
perform complex tasks such as:
- Generating and regenerating frequently sites from a DB and other sources.
- Automatic and semi-automatic code generation for ASP, HTML etc.
- Collecting information from sets of HTML/ASP pages.
- Creating projects, index, contents files and other files for another tools (such as
Windows HTML help)
- Generation/regeneration of ASP/HTML sites that need maximum performance - by moving part
of the code in the ASPC and exposing as much page as possible as static HTML or at least
simple ASP.
- Almost unlimited WEB oriented custom tasks the developer may want to implement as
extensions to ASP Compiler.
- HTML Template mechanism available without ASP Compiler through its parser component. Can
be used by the ASP pages to fill template HTML pages.
The new feature is called Compile Time Scripting (CTS). As the name claims this
means it is scripts executed at compile time. They could be embedded as parts of the
compiled pages or/and attached to the files in the ASP Compiler's project. The CTS can
be compared to the ASP itself - e.g. embedded scripts look like this:
<SCRIPT RUNAT=Compiler Language=VBScript>
Node("Class") = "Text"
Node("Content") = "Hello World!"
</SCRIPT>
But they look also a bit similar to the DHTML scripts. In two words CTS is
executed in way very similar to the ASP but while ASP code is executed on the server CTS
code is executed during the page compilation. And they "see" the page in form
similar to the DHTML object model - while the ASP code generates just output - the CTS
manages the page as a tree of nodes that represent its elements. The object model is much
more simple than the the DHTML and the CTS itself may request itself from the compiler the
details it really needs to know about the page and ignore the rest of the page unchanged
and non-parsed.
As a result the compiler supports extensions in two major forms:
- Scripts that extend the ASP Compiler and perform advanced processing tasks during the
file compilation (the term used in the documentation is file attached scripts).
They may include configuration dialog and help and are configured in the ASPC's project to
extend the processing of certain file(s).
- Scripts in the processed pages (term in the documentation embedded scripts).
Therefore the compiled pages are "active" - they may contain code that
runs during the compilation.
This features are designed for HTML and ASP pages. They are used together with the HTML
and the ASP code in the page and also they have access to the project settings, compiler
variables and to each other. And all of them could be combined with compilation to COM
DLL!
What this means for the programmer?
The CTS is a flexible feature that may help to improve variety of tasks. CTS could be
used to automate frequently performed programming tasks or just to generate part of the
pages (which changes rarely) off-line and thus reduce the server overhead. A large WEB
site could be separated in several ASPC projects and CTS may take care to
construct/reconstruct the pages. All the repeated tasks could be moved to CTS scripts
step-by-step.
One of the most important features of the CTS is the opportunity to begin with embedded
draft script and step-by-step improve it and move it outside the pages, then make it
available for any project and finally document it and add user-friendly configuration.
Thus the programmer has the appropriate way to think-and-implement - from the initial
phase when he/she still wanders how to automate the task/implement the feature to the
final phase - packing the CTS in reusable form available for the other developers. Thus
the embedded scripts could be written initially between the <SCRIPT RUNAT=Compiler>
... </SCRIPT> tags, than moved in external file <SCRIPT RUNAT=Compiler
SRC=file.vbs> and used in several files in the project, than move them to the ASPC
library and use them from thifferent projects and so on.
The beta ships with many examples. Take a look at them to see different tricks - from
"Hello World" to automatic generation of an ASP page.
HTML Template? ASP Compiler uses internally an universal parser component. Its
HTML related capabilities could be used outside ASP Compiler to prepare ASP pages that
include no HTML code, but use HTML templates obtained from external files or DB. The
parser is capable to help even if the HTML page is not designed as a template initially!
With the parser the ASP page is able to load a HTML file and replace/modify its content in
a way similar to the DHTML. Thus, for example, you can set ID attribute and assign name to
certain HTML element, then load the file and pass it to the parser, get the named element,
modify it and send to the browser the modified page. In contrast of DHTML the ASP page
tells the parser exactly what it is interested of. And the object model of the page
contains only the explicitly requested elements - the rest will remain unchanged.
Therefore templates can be prepared or adopted for seconds from existing pages. The same
technique is also applicable if information from a HTML page is to be extracted (such as
keywords in the <META name="keywords" ...> HTML element).
Already interested?
Download the beta. We strongly recommend
the examples. The documentation is under construction and the example will be better as a
first step.