有条件的包括 [英] Conditional Includes

查看:81
本文介绍了有条件的包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这将在asp 3.0中运行:


如果为True则

<! - #include file =" test1.asp" - >

Else

<! - #include file =" test2.asp" - >

结束如果


- Thomas

Hi,

Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

- Thomas

推荐答案

你的IF很奇怪,但前提是正确的

-

Curt Christianson

所有者/首席开发人员,DF软件
www.Darkfalz.com

" Thomas" <第**** @ corpuslogic.com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
your IF is weird but the premise is correct
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Thomas" <th****@corpuslogic.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...


这是否适用于asp 3.0:

如果是,则
<! - #include file =" test1.asp" - >
Else
<! - #include file =" test2.asp" - >
结束如果

- Thomas
Hi,

Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

- Thomas



是和否。

首先处理包含文件,因此将插入test1.asp和

test2.asp的内容。然后将处理您的if / then.


可能更好的解决方案是将test1.asp的内容包装在

子例程中,并将test2.asp包装在单独的子例程中。


示例。


test1.asp


Sub test1sub()
来自test1的
''代码.asp

End Sub


test2.asp


Sub test2sub()

''来自test2.asp的代码

End Sub


page.asp

<! - #include file = " test1.asp" - >

<! - #include file =" test2.asp" - >


如果是真的然后

调用test1sub

else

调用test2sub

" Thomas" <第**** @ corpuslogic.com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
Yes and no.
The include files are processed first, so the contents of test1.asp and
test2.asp will be plugged in. Then your if/then will be processed.

Probably a better solution would be to wrap the contents of test1.asp in a
subroutine, and test2.asp in a separate subroutine.

Example.

test1.asp

Sub test1sub()
''code from test1.asp
End Sub

test2.asp

Sub test2sub()
''code from test2.asp
End Sub

page.asp
<!--#include file="test1.asp"-->
<!--#include file="test2.asp"-->

If True then
Call test1sub
else
Call test2sub
"Thomas" <th****@corpuslogic.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...


这是否适用于asp 3.0:

如果是,则
<! - #include file =" test1.asp" - >
Else
<! - #include file =" test2.asp" - >
结束如果

- Thomas
Hi,

Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

- Thomas



是的,它会起作用,假设你开始和结束你的ASP块

正确 - 虽然可能不是你期望的方式。这两个文件都将包含在内,但只会使用符合条件的文件。


" Thomas" <第**** @ corpuslogic.com>在消息中写道

新闻:#o ************* @ TK2MSFTNGP12.phx.gbl ...
Yes, it will work, assuming you start and end your ASP blocks
correctly -- though probably not in the way you expect. Both files will
be included, but only the one that matches the condition will be used.

"Thomas" <th****@corpuslogic.com> wrote in message
news:#o*************@TK2MSFTNGP12.phx.gbl...

这将在asp 3.0中运行:

如果是,那么
<! - #include file =" test1.asp" - >
Else
<! - #include file =" test2.asp" - >
结束如果

- 托马斯
Hi,

Will this work in asp 3.0:

If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If

- Thomas



这篇关于有条件的包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆