是否可以在 asp-classic 中发布动态包含? [英] is it possible to issue dynamic include in asp-classic?
问题描述
我的意思是,像 php'h 包括...
类似
<上一页>my_file_to_be_included = "include_me.asp"-->就我目前所见,有几种选择,但每一种都有一些缺点......
我想弄清楚的是如何制作一个灵活的模板系统...而不必使用 loooooong case 语句将整个内容静态包含在单个文件中...
这里有几个链接
使用 FileSysmemObject 的解决方案,只允许您包含静态页面
但它有一些我想避免的缺点......似乎(还没有尝试过)Server.Execute 代码在另一个上下文中运行,所以你不能用它来加载你计划的函数在调用者代码中使用...讨厌...
同样的事情p>
我不确定(还不能测试它),但似乎这个 dinamycally 将页面处理为 SSDI 组件...
有什么想法???
不,你不能做动态包含,句号.
你最好的方法是 server.execute 并通过 Session 变量传递它需要的任何状态:-
Session("callParams") = BuildMyParams() '创建某种字符串Server.Execute(my_file_to_be_included)Session.Contents.Remove("callParams")
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
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...
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???
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")
这篇关于是否可以在 asp-classic 中发布动态包含?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!