Advertisement
Java_Volume1 Miscellaneous #101372

Dynamic File Includes

This is version 2 of the previous submission "True Dynamic Includes". This class allows you to dynamic include a file into your script. Please vote and give me some feed back.

AI

AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

源代码
original-source
<p><b><font face="Verdana" size="2">New Features</font></b><br>
<font face="Verdana" size="2">
 • supports both HTML and ASP in the same page.<br>
 • handles standard include files.<br>
 • encapsulated into class for speed and robustness.
</font></p>
<p><b><font face="Verdana" size="2">Purpose</font></b><br>
<font face="Verdana" size="2">I, as like most ASP developers have wanted the 
ability to dynamically include script files. If dynamic includes were possible 
we would be able to increase performance if existing code, add files based upon 
a variable value and even change the structure of page creation. The 
possibilities are enormous.</font></p>
<p><b><font face="Verdana" size="2">Basics</font></b><br>
<font face="Verdana" size="2">The function is actually very simple. It reads 
the passed file using the filesystem object. Then it removes the surrounding ASP 
delimiters &quot;&lt;% ... %&gt;&quot;. This allows us to re-use existing files. The files 
contents are then passed through the vbscript method &quot;ExecuteGlobal&quot;. This will 
stick the content into the current process and give us access to it. Below is an 
example of how to include a file.</font></p>
<p>&lt;!--#include file=&quot;include.asp&quot;--&gt;<br>
<font face="Verdana" size="2">&lt;%</font><br>
<font face="Verdana" size="2">&nbsp; include &quot;file1.asp&quot;</font><br>
<font face="Verdana" size="2">&nbsp; output &quot;procedure test&quot;</font><br>
<font face="Verdana" size="2">%&gt;</font></p>
<p><b><font face="Verdana" size="2">Limitation</font></b><br>
<font face="Verdana" size="2">This class will not support vbscript statements like &quot;Option Explicit&quot; or &quot;&lt;%@ ... %&gt;&quot;.</font></p>
<p><b><font face="Verdana" size="2">Conclusion</font></b><br>
<font face="Verdana" size="2">I really hope that you find this as useful as I 
have. I would appreciate any comments or suggestions for future 
version to increase performance and robustness. I would also appreciate you 
votes.</font></p>
<p><b><font face="Verdana" size="2">Future</font></b><br>
<font face="Verdana" size="2">Stay tuned for version 3. Implementing an entire website from a database.</font></p>
原始评论 (3)
从 Wayback Machine 恢复