This is a discussion on "Can I use #include within an If Then statement?" within the Classic ASP section. This forum, and the thread "Can I use #include within an If Then statement? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Can I use #include within an If Then statement?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Can I use #include within an If Then statement?
If so, how do I do this?
|
|
|
|
|||
|
Re: Can I use #include within an If Then statement?
Nevermind - I figured it out...
|
|
|||
|
Re: Can I use #include within an If Then statement?
AAAARGH! The above does not actually work!
The #include includes the file regardless of how the If statement evaluates! Grrr...
I know I can get around this by simply putting the actual contents of the included files within the If statement, but is there another way to make the above work? |
|
|||
|
Re: Can I use #include within an If Then statement?
Yes, that is possible, but the source will be
<% If this = "that" Then %> <% 'File 1 %> some text or any functions <% Else %> <% 'File 2 %> some text or any functions <% End If %> as you see, the IF statement will still be there, but both files will be included |
|
|||
|
Re: Can I use #include within an If Then statement?
ths is how i included files by specific variables earlier, but now in using Function() instead, by already including the file at the start of the ASP source
|
|
|||
|
Re: Can I use #include within an If Then statement?
You have two options to dynamically "include content".
1) use the execute method wich will run the ASP page in much the same way as the include method..... if x = y then execute "myfile.asp" else execute "myfile2.asp" end if or 2) the less pleasant way is to use FSO to read the contents of the file then write it out to the client. this is no good if the file contains serverside code. |
![]() |
| Tags |
| use, include, within, then, statement |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP If Statement... | mcdanielnc89 | PHP Forum | 16 | Dec 9th, 2007 17:44 |
| Include() Statement Is Getting Hacked | peterwilby | PHP Forum | 1 | Apr 26th, 2007 03:03 |
| If..Else statement help | IanW | PHP Forum | 3 | Oct 6th, 2006 13:40 |
| Help with If Statement. | JohnMitch | Classic ASP | 2 | Jan 5th, 2005 01:05 |
| With Statement | Trebz | Classic ASP | 2 | Feb 2nd, 2004 14:56 |