|Root specific links|
Can Dreamweaver support this?
| 12:09 pm on Feb 4, 2003 (gmt 0)|
We are working on a project where out clients server setup uses root specific linking. For example, an image link would look like:
Where the folder "website" resides in the (web) root directory.
I am trying to find a way that will allow us to recreate this in Dreamweaver, so that our code is ready to ship over directly (as opposed to searching and replacing in the link structure).
Has anyone every done this? Or know how to do this?
All help/suggestions greatly appreciated!
| 12:36 pm on Feb 4, 2003 (gmt 0)|
It should work in Dreamweaver. I use relative links quite often. The problem seems to come in when Dreamweaver sometimes adds a ".." to the beginning of the reference, even if the page is in the root directory. The ".." means "up one level" so if you're in the root, it just leaves you there. Therefore, if that is in the code, it'll work on level 1 and 2 directory, but as soon as you get the page into a level 3 directory it's going to die on you.
Does that make sense? Maybe I'm misunderstanding your question...
| 12:42 pm on Feb 4, 2003 (gmt 0)|
That makes perfect sense! ;)
It's the "../" I want to eliminate.
For example, if I am in a folder called pages (/website/pages/) and I want to link to an image in my images folder (/website/images/), normally I would use:
However, in my root specific environment I want to use a link structure like this:
Does that make sense?!? It is this sort of linking convention that I wish Dreamweaver to adopt.... if possible!
| 12:58 pm on Feb 4, 2003 (gmt 0)|
Templates in DW will adjust relative links to where you save the file, in my experience, so relative links usually work fine. If I'm not using templates (e.g., an include file)and have a multi-tiered site with several levels of folders, I just use the brute force approach and make the links absolute, i.e., "http: //www.domain.com/page.htm" . There may be a more elegant way to do this, but it works.
| 12:59 pm on Feb 4, 2003 (gmt 0)|
I don't think it'll do it, BUT, it won't change it if you go in and change it. It's a drag, but what I've done is just delete the "..". A global find and replace will take care of your existing ones. FIND: '<img src="../"' replace with '<img src="/"'.
NOTE: I've got a toggle set in my DW settings to Not Change Code. I forget exactly where it is - somewhere in the site setup settings. I'm not sure what happens if you don't have that set.
It also adds those blasted ".." things to SSI's, so keep an eye on that, too, if you're using them.
| 1:17 pm on Feb 4, 2003 (gmt 0)|
Um, unless I'm missing something, is this not as simple as selecting (from the drop down menu at the bottom of the 'insert link' dialog box labelled 'relative to') the option for 'site' relative as opposed to 'document' relative?
We use (almost exclusively) root-relative, and my biggest beef with DW and this setting is that it's not 'sticky' and keeps resetting to doc. rel by default.
| 1:23 pm on Feb 4, 2003 (gmt 0)|
Thanks for the replies. I've found a way to do this.
Once you have a site definied in the Sites pane, applying a root-specific linking convention is quite straight forward (it took some creative search terms on the Dreamweaver help file!).
When you are using the WYSIWYG to insert images/flash/SSI you need to change the Relative To: setting from Document to Site Root. This will use the proper link (/site/folder/whatever.jpg).
What I need to do now is to create a site on our development server, so that this linking convention works correctly when you go to view the pages. This is straightforward enough in IIS, by using the IIS Manager and defining a new site.
This means, for me, that I by prompting my team to use Relative To: Site Root on all their links, we no longer need to do a global search and replace and our code is ready to ship!
<added>Hey mat, just spotted you post - that's it alright! Thanks a million!</added>