Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

virtual include trouble

Status
Not open for further replies.

hagartyman

Programmer
Dec 4, 2002
9
US

Hi,

Please forgive me if the following seems elementary. I haven't used ASP in about 1 year though and have forgotten some of the elementary items.

I have the following issue: I have a virtual include that works on a page on my root directory but the include does not work on a page that is two subdirectories down. Here is the include:
<!-- #INCLUDE VIRTUAL=&quot;/fastrak/includes/home_template.asp&quot;-->

The directory structure is fastrak\body_pages\home. This is where the virtual doesn't work. Please help.
 
try using the server.execute method instead
<% Server.Execute &quot;/fastrak/includes/home_template.asp&quot; %>
---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
what was the output?

try saving the home_template.asp as home_template.inc and retry the include syntax

the server.execute may not like the path. ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
tested server.execute without () and it didn't as I thought like the path
try this also
<% Server.Execute(&quot;/fastrak/includes/home_template.asp&quot;) %>

I've tested both syntax to working output so if you still have problems there may be a problem with the file you are trying to include ---------------------------------------
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
both the <!-- #INCLUDE VIRTUAL=&quot;/fastrak/includes/home_template.asp&quot;-->

and <% Server.Execute(&quot;/fastrak/includes/home_template.asp&quot;) %>

work off of the root directory. When I move these to the fastrak/body_pages/home/default.asp it doesn't load the template.
 
I just figured it out. I named the file .htm instead of .asp. That caused the trouble. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top