Download it: ASPC 1.1 beta ZIP (1.1MB) SFX install (850Kb)
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:
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!"
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:
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).
Download the beta. We strongly recommend the examples. The documentation is under construction and the example will be better as a first step.