包含文件可以识别经典 asp 中的调用页面吗?

发布于 2024-08-05 16:56:57 字数 387 浏览 1 评论 0原文

我有 2 个由作业自动生成的 asp 文件集合。集合 1 具有虚拟路径“/collection1/”,集合 2 具有虚拟路径“/collection2/”。两个集合都有相同的 asp 代码:

<!-- #include file="../SSI/Template.inc" -->

在 Template.inc 内,我有一些典型的 html 模板。但是,我希望集合 1 具有与模板 2 不同的模板。所以我的问题是,我的包含文件是否可以确定刚刚调用它的页面,以便我可以执行简单的 if 语句并显示不同的模板?

最简单的方法似乎是改变工作来呈现不同的 asp,但这不是一个选项。

编辑 - 我可以添加 .inc 的处理程序以转到 classicasp。

I have 2 collections of asp files that are auto generated by a job. Collection 1 has a virtual path of "/collection1/" and collection 2 has a virtual path of "/collection2/". Both collections have the same asp code:

<!-- #include file="../SSI/Template.inc" -->

Inside Template.inc I have some typical html templating. However, I'd like collection 1 to have a different template than template 2. So my question, can my include file determine what page just called it so I can do a simple if statement and display a different template?

The easiest way may seem to change the job to render different asp, but this is not an option.

edit - I can add a handler for .inc to go to classicasp.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裂开嘴轻声笑有多痛 2024-08-12 16:56:57

正如您所说,您的集合位于不同的虚拟路径中。因此,您可以检查页面的 URL(使用 服务器变量)并根据路径进行渲染。

例如,以下内容可以放置在 ../SSI/Template.inc 中:

if instr(Request.ServerVariables("URL"), "/collection1") > -1 then
  'render html for collection 1
else
  'render for collection 2
end if

As you say your collections are located in different virtual paths. So, you can check the URL of your page (using server variables) and render according to the path.

E.g. the following could be placed in the ../SSI/Template.inc:

if instr(Request.ServerVariables("URL"), "/collection1") > -1 then
  'render html for collection 1
else
  'render for collection 2
end if
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文