Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

is it possible to issue dynamic include in asp-classic?

I mean, like php'h include...

something like

my_file_to_be_included = "include_me.asp"

-- >

for what I've seen so far, there are a couple of alternatives, but every one of them has some sort of shortcoming...

what I'm trying to figure out is how to make a flexible template system... without having to statically include the whole thing in a single file with a loooooong case statement...

here there are a couple of links

a solution using FileSysmemObject, just lets you include static pages

idem

yet another one

same thing from adobe

this approach uses Server.Execute

but it has some shortcomings I'd like to avoid... seems like (haven't tried yet) Server.Execute code runs in another context, so you can't use it to load a functions your are planning to use in the caller code... nasty...

same thing

I think this one is the same

this looks promising!!!

I'm not sure about it (couldn't test it yet) but it seems like this one dinamycally handles the page to a SSDI component...

any idea???

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

No you can't do a dyanmic include, period.

Your best shot at this is a server.execute and passing whatever state it needs via a Session variable:-

Session("callParams") = BuildMyParams() 'Creates some sort of string
Server.Execute(my_file_to_be_included)
Session.Contents.Remove("callParams")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...