If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

more on relative vs absolute paths

Maybe this is not a problem with other HTML editors, , if not please let me know, as I'm still using the old HOMESITE editor.

I like to use relative paths, mainly so I can test my site locally with browsers on my file system, and also because absolute paths to graphics has in one instance caused my hosting company a lot of grief (I'll skip the details unless someone is interested).

So when I'm developing, it would really be nice if I could still use the "root" (/) as a starting point. That way, for example,, wherever a page ends up in a directory tree, a <link> tag like this will always work...

But of course that won't work when testing on my home computer. Is there a workaround for this? Is there a way to tell Homesite that when interpreting links, "/" should refer to the project root? If not, would Coffeecup be able to do this? I don't think I can use "./" as a substitute, can I?

Yeah thanks. I do that a lot, and in fact the editor usually does that for me pretty well. But of course being able to start from the project root would be ideal. If there's no other way, i can live with it.

Unless you put your local files at the root of the drive that's your only choice. I've thought about using a thumbdrive for website development simply because of that. But it means keeping track of that drive, making sure it's plugged in when I need to work on a site, etc. etc. So far, not worth the effort. Although it might be worth the effort to have local website files on a dedicated partition.

Kevin: Yeah that's a really good idea!!! I never thought of that! I don't know if I'd want to use a thumb drive either, but either a small partition on my main drive or a secondary drive would solve this issue for good!

/ = root
./ = current working path where html document is saved
../ = move up one directory

Using relative paths should not pose a problem in any editor, the only editor that I found was a royal pain in the rear was the Adobe Indepth which insisted on writing in javascript and fixing paths so it was an absolute path.

Your testing server... What are you using?

--> JavaScript Frameworks like JQuery, Angular, Node <--
... and please remember to wrap code with forum BBCode tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...

Mr :\\127.0.0.1 (can i call you loopback for short ;-) By hosting server has no problem with any of those constructs. Its just that when testing code in my own machine, any link that starts with a root "/" will try to go to the root of my "C:\" drive, instead of the root of my project. This is all static page development, so there really is no server involved... just a browser.

That is why I asked if you have a server on your PC for proper testing. If not then I can suggest that you try something like XAMPP which you can get from portable Apps which is a system that allows you to install and run from a *USB drive / flash drive / thumb drive / stick drive and test in a proper web based environment that you can refer to in a web browser by IP address or the loopback name.

If you edit your local hosts file, you can add in a name and point it to 127.0.0.1 and end up with http://testing/ for example

your hosts file is found in %windir%\system32\drivers\etc\hosts

copy %windir%\system32\drivers\etc\hosts and open a run dialog and paste, hit return and select notepad to open the file then you will see something like...

Code:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost

after 127.0.0.1 localhost on a new line put
127.0.0.1 testing

then save the file, close and then you will have a URL for http://testing/ that will open up the root page for your installed server (obviously when you have your server installed!)

One way to have project-specific root directories is to install multiple instances of a localhost. I use wampserver installed on a network file server, and separately on the local workstation, but you could have multiple instances on your workstation. Each instance points the localhost root (http://127.0.0.1 otherwise known as http://localhost) to the \www\ directory in ...\wamp\ directory you installed wamp into. So you can have, say, C:\project1\wamp\www\... and C:\project2\wamp\www\... etc... So, depending upon which instance you have running, localhost will point to a different root. However, I'm no sure what would happen if you tried running multiple instances simultaneously on a single workstation.

If you need to work on multiple projects simultaneously, you would need to have multiple servers on your LAN, with one localhost on each. That is not as expensive as it may sound, I use a spare 10 inch netbook computer as a network file server. Throughput and disk capacity is not an issue.

If you don't want to install a server and don't want to use a flashdrive, you can use the "subst" command in Windows to associate a new virtual drive to an existing path on the local machine. Open a command prompt and type the following to create a new X: drive for the path C:\WebFiles

Yeah I instantly thought of it when I read this thread. Only one setback I can think of is it might not persist across reboots. Then again it's pretty easy to make a batch file to run the command so it won't need to be typed each time. Could even place a shortcut to it in the start menu's startup folder so it's automatically done at each login (if of course the command prompt flashing by on login isn't considered an annoyance).

That takes me back. I did not know that old MSDOS command still works! If so, it is a far simpler solution.

Not really because your links will end up with a directory structure referencing files:\\\X:\blah\blah\webpage.html where as installing XAMPP is as simple as a double click on an Icon, your testing will be exactly the same as it would be on a web host but all your debugging will be local.

Really don't see how putting a development service on your PC is going to be a hard job.

--> JavaScript Frameworks like JQuery, Angular, Node <--
... and please remember to wrap code with forum BBCode tags:- [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]If you can't think outside the box, you will be trapped forever with no escape...

Well thanks everyone. I must say this webdeveloper forum is filled with some of the most helpful folks I've encountered in quite some time. Very refreshing. As is often the case, in the midst of many things to do I also have many new things to try. But that sure beats not having a clue with no one to help.

As far as the web server, I guess I'm going to have to do this eventually, especially if I begin experimenting with a CMS system like Joomla. I do have my concerns though. First, I think it best i install a web server on another box. I certainly have extras floating around. That way I can better duplicate the operating environment of my hosting company. I am curious about the virtual drive solution too, and adding a name to my local hosts is an idea something I totally forgot! Lots of good tips. Thanks again everyone!

Not really because your links will end up with a directory structure referencing files:\\\X:\blah\blah\webpage.html where as installing XAMPP is as simple as a double click on an Icon, your testing will be exactly the same as it would be on a web host but all your debugging will be local.

Really don't see how putting a development service on your PC is going to be a hard job.

I'd have to agree with you, and I would also recommend XAMPP as the software of choice. There is the right way of doing things, and the quick way of doing things. However sometimes the quick way doesn't hurt.