Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Include help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Include help

 Post Reply Post Reply Page  12>
Author
DaFool View Drop Down
Groupie
Groupie


Joined: 13 August 2002
Location: United States
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaFool Quote  Post ReplyReply Direct Link To This Post Topic: Include help
    Posted: 29 October 2003 at 1:42pm
'If the header ad image variable isnt empty, display the image
If strSiteHeaderImage2 <> "" Then
 Response.Write(vbCrLf & "         <td width=""100%"" align=""right"">%><!--#include file="../BannerRotator.asp"--><%</td>")
End If

What's wrong with this file?
Back to Top
ctscott View Drop Down
Senior Member
Senior Member


Joined: 27 May 2003
Location: United States
Status: Offline
Points: 246
Post Options Post Options   Thanks (0) Thanks(0)   Quote ctscott Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 1:57pm

to quote from my visual studio 6.0 documentation:

"You can also use the file keyword with ../ syntax to include a file from a parent, or higher-level, directory if the Enable Parent Paths option is selected in Internet Service Manager."

that may be the problem but i don't know.  you can also try using the "virtual" keyword in place of "file" where you indicate a path beginning with the virtual directory.

 

Back to Top
DaFool View Drop Down
Groupie
Groupie


Joined: 13 August 2002
Location: United States
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaFool Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 3:08pm
thats not the problem, it has to be something else. Thanks for your reply
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 4:16pm
the problem is that include files are ran before any other asp code, so you can't put an include file in an if statement.
Back to Top
ctscott View Drop Down
Senior Member
Senior Member


Joined: 27 May 2003
Location: United States
Status: Offline
Points: 246
Post Options Post Options   Thanks (0) Thanks(0)   Quote ctscott Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 7:10pm
learn something everyday.
Back to Top
DaFool View Drop Down
Groupie
Groupie


Joined: 13 August 2002
Location: United States
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaFool Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 7:56pm
then how do I need to go about getting this thing to work?
Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 8:45pm
The problem was that you closed the <% %> tags without finishing the Response.Write, a simple way would be to do this:

If the header ad image variable isnt empty, display the image
If strSiteHeaderImage2 <> "" Then %>
<td width="100%" align="right"><!--#include file="../BannerRotator.asp"--></td><%
End If

Or this:

If the header ad image variable isnt empty, display the image
If strSiteHeaderImage2 <> "" Then
Response.Write(vbCrLf & "        <td width=""100%"" align=""right"">") %>
<!--#include file="../BannerRotator.asp"-->
<% Response.Write("</td>")
End If

<edit> You can't close the script block unless you're done with the command like you do with html... You had closed the script block right in the middle of the Response.Write, you had to finish it first, then close it, include the file, and start a new response.write... It would just make more sense and perform better to just use HTML instead of Response.Write as in my first example...

Edited by fernan82
FeRnAN
Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 9:01pm
Originally posted by KCWebMonkey KCWebMonkey wrote:

the problem is that include files are ran before any other asp code, so you can't put an include file in an if statement.


You sure can put it on an If statement, what you can't do is put it inside a Response.Write. In that case the problem was that the script block was closed before closing the response.write...

The includes are not exactly ran before the asp code, many people think that but it's incorrect. The includes just can't be placed inside ASP code cuz they're not ASP and can't be used on Response.Write cuz they're not client side stuff that's why they're called server side includes (Response.Write just sends text to the browser).

As long as it's not inside a script block you can use it anywhere... What you can't do is include the same file or two files with the same variables on the same script cuz the server includes the files before executing any ASP so you'll get a variable redefined error... same as if you do this:

If strHuh = "Hello" Then
     Dim intHuh
     intHuh = 5
Else
     Dim intHuh
     intHuh = 1
End If

Even though the var is only gonna be defined once that would cause a variable redefined error...
FeRnAN
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.