Forum Moderators: open

Message Too Old, No Replies

include file is problem

include file

         

justify

3:40 pm on Jul 6, 2003 (gmt 0)

10+ Year Member



Evrey Body hi
How can i define variable in the
<!--#include file = "news_files" --> or <!--#include virtual = "/news_files" --> in fact i want to do things, to read an extensions ".htm " filesand to show my asp page them Do you have any advice this code get erorrs lik that

Error Type:
Active Server Pages, ASP 0126 (0x80004005)
The include file haber_dosyasi was not found.
/anews/ozelhaberinfo.asp, line 253

<%
yol = "C:/1055/"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set dosya = objFSO.GetFolder("C:/1055/")
Set karmadosyalar = dosya.Files

For each dosyax in karmadosyalar
a= objFSO.GetBaseName(dosyax.name)

if a = rs("FILENAME") Then

haber_dosyasi = "yol & a & ".htm
%>

<!--#include file = "haber_dosyasi" -->
<%
End if
Next
%>

garann

9:17 pm on Jul 7, 2003 (gmt 0)

10+ Year Member



Hi justify,

It looks like you're having two problems.

1. In this line:


<!--#include file = "haber_dosyasi" -->

it appears you're trying to use the variable haber_doayasi to substitute the path of the file you want to include, but you haven't used the syntax that tells ASP to print the value of that variable. What you want is:

<!--#include file = "<%= haber_dosyasi %>" -->

2. An include is read before ASP. That means you can't have an ASP variable for the name of the file you want to input. If I understand what you're trying to do, you'd need to check the string sent in rs("FILENAME"), and use if/then to see which file it referred to and serve that file, like:


<%
if rs("FILENAME") = "foo" then %>
<!--#include file="C:\1055\foo.htm" -->
<%
elseif rs("FILENAME") = "bar" then %>
<!--#include file="C:\1055\bar.htm" -->
<% else ... %>

You're best bet is probably to find a way to do this without includes. You could, for instance, use a variable to load the source of an iframe.

Good luck,
g.