Advertisement
ASP_Volume3 Miscellaneous #46037

True Dynamic Includes v1

Exactly as it sounds. This function will allow you to dynamic include a file into your script. From my knowledge this has not been done. 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">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;script.asp&quot;</font><br>
<font face="Verdana" size="2">&nbsp; output &quot;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">I made this version fairly simple. You can not 
include files with HTML. It will only recognize the surrounding ASP delimiters 
&quot;&lt;% ... %&gt;&quot;. Version 2 which will be posted here in a couple days will take care 
of that problem.</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. Since this is so unique I would very much appreciate that you recognize 
where you got it. 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">See Version 2
<a href="http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=7635&lngWId=4">
here</a>.</font></b></p>
원본 댓글 (3)
Wayback Machine에서 복구됨