- This topic is empty.
June 7, 2014 at 10:46 pm #172170lkeeneyParticipant
Say I have an “include” directory located at this address:
The file nav2.html is included in this “include” directory.
I am trying to put the code from the nav2.html file into this file:
If I use the following code the code from the nav2.html file will be placed in the file.
<!–#include virtual=”/abc/include/nav2.html” –>
Why doesn’t this code work?:
<!–#include virtual=”../include/nav2.html” –>
I must have done this a hundred times without any problem, but on this new website I am working on it doesn’t work.
It is late and I am frustrated so if this doesn’t make sense, what I am trying to do is to load a file which is located in a folder, and this folder is one level back from the file into which I want to load this information.June 8, 2014 at 10:32 pm #172201nixnerdParticipant
I’m going to guess this is some sort of relative file path issue… but I don’t really know. It looks legit to me as the include structure is basically identical to PHP… aside from the weird crunch/octothorpe nonsense :) I’ve never worked with ASP on any level.
Just so you know… on a UNIX based system
..means jump up (or I guess down? depending on how you envision it) one level in the directory tree. So… make sure the included file is where you’re saying it is.
../include/nav2.htmlmeans “Go one level closer to the root directory, then go into the ‘include’ directory, then grab ‘nav2.html’.” I don’t know what type of system you’re on or how it works (I know nothing about Windows) but it’s probably the same. Just make sure your files are where they need to be.
Or… just roll with an absolute file path, in which you tell the main file EXACTLY where the file to be included resides. You do this relative from the ROOT directory… not from the main file.
Think of the difference in terms of directions. An absolute file path is kind of like exact coordinates. A relative file path is like “Dude, if you’re coming from the highway, just turn right when you hit the stop light. It’s past the liquor store.” It’s relative from where you are at any given time.
I hope that all made sense :)June 9, 2014 at 2:49 am #172205MawahaParticipant
In your example the relative path should be
<!–#include virtual=”../abc/include/nav2.html” –>June 9, 2014 at 2:21 pm #172259lkeeneyParticipant
I want to thank everyone for their help on this problem. The following morning everything become much clearer.
- The forum ‘Other’ is closed to new topics and replies.