As early as 2003, I saw articles on Include on Blue Ideal. I thought it was very powerful at that time, but after actually applying it, it was inconvenient and the effect of Include was not good.
Later I saw an improved version on a website, but it was not very useful~~~
Alas, I really felt that I wanted to give up ASP at that time, but since the company still used ASP to develop, I had no choice...
Today, I must remember today~~~ I actually found such a good thing on a foreign website, which is great~~~ Greatworks!!!
Some dynamic Include codes I tried before cannot include a class, or even functions~~~ or the Include in the Include file cannot be included...
Now the class written by this ghost guy (dselkirk) can do this for us~~~
The code copy is as follows:
<%
publicinclude, include_vars
setinclude=newcls_include
classescls_include
privatesubclass_initialize()
setinclude_vars=server.createobject("scripting.dictionary")
endsub
privatesubclass_deactivate()
arr_variables.removeall
setinclude_vars=nothing
setinclude=nothing
endsub
publicdefaultfunctioninclude(byvalstr_path)
dimstr_source
ifstr_path<>""then
str_source=readfile(str_path)
ifstr_source<>""then
processincludesstr_source
convert2codestr_source
formatcodestr_source
ifstr_source<>""then
ifrequest.querystring("debug")=1then
response.writestr_source
response.end
else
executeglobalstr_source
include_vars.removeall