Setting Path 
Author Message
 Setting Path

Hi Folks,

The code below will include (at random) one of the following files into my
web page:
text1.htm, text2.htm, text3.htm, text4.htm or text5.htm.

My question is - How do I go about inserting the required path for those
files.  Having to place each of the textx.htm files in the same directories
as each of the pages they are being included in defeats the entire purpose,
which was to enable me to maintain and edit one set of external files rather
than editing 100 different pages when ever a change needs to be made.

Point 1: I do not want to use the command <!--#include virtual="file.inc"-->
if I can help it.

Point 2: If I simply change [the page_to_read="text"& random_number &".htm"]
to [the page_to_read="/abcdefg/text"& random_number &".htm] I get the
following error:

"Server.MapPath() error 'ASP 0174 : 80004005'"

PLEASE HELP ME.  Thanks Here is the code:

<%
randomize
random_number=int(rnd*5)+1

page_to_read="text"& random_number &".htm"

set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(page_to_read))

read_text = act.readall

act.close

response.write read_text
%>



Tue, 28 Oct 2003 19:49:58 GMT  
 Setting Path
the page_to_read="/abcdefg/text"& random_number &".htm

this means the folder is under the "root"

if your folder is under your "current" directory then you need to use the
dot...

the page_to_read="./abcdefg/text"& random_number &".htm

otherwise check your path...

--
Jane Alford
Software Engineer, Worldport Communications Inc
Dublin, Ireland


Quote:
> Hi Folks,

> The code below will include (at random) one of the following files into my
> web page:
> text1.htm, text2.htm, text3.htm, text4.htm or text5.htm.

> My question is - How do I go about inserting the required path for those
> files.  Having to place each of the textx.htm files in the same
directories
> as each of the pages they are being included in defeats the entire
purpose,
> which was to enable me to maintain and edit one set of external files
rather
> than editing 100 different pages when ever a change needs to be made.

> Point 1: I do not want to use the command <!--#include

virtual="file.inc"-->

- Show quoted text -

Quote:
> if I can help it.

> Point 2: If I simply change [the page_to_read="text"& random_number
&".htm"]
> to [the page_to_read="/abcdefg/text"& random_number &".htm] I get the
> following error:

> "Server.MapPath() error 'ASP 0174 : 80004005'"

> PLEASE HELP ME.  Thanks Here is the code:

> <%
> randomize
> random_number=int(rnd*5)+1

> page_to_read="text"& random_number &".htm"

> set fso = createobject("scripting.filesystemobject")
> set act = fso.opentextfile(server.mappath(page_to_read))

> read_text = act.readall

> act.close

> response.write read_text
> %>



Tue, 28 Oct 2003 20:01:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting path to location of current mdb file

2. How do I get the settings path

3. Setting path for line

4. Setting Path to Access Database

5. Setting Path to Access Database

6. Setting path to database from text file ??

7. **Setting Paths for Data Controls**

8. How to set path for database (.mdb) file ???

9. How to set path for d

10. : How to set Path

11. How do I set path current from dir1 and drive1 objects

12. Set Path for Shell command in Visual Basic

 

 
Powered by phpBB® Forum Software