| |
Local file
references
...or why
your site looks fine on your computer, but no one else can see the
graphics.
The
Extension Web Coordinator has a serious pet peeve: Local
File References. What does that mean? When your HTML file references
(or calls, or refers to) a graphic (or other) file, it displays
the path as file:///C|/Web%20Folders/MyStupidWebFolder/images/ce_01.gif
instead of images/ce_01.gif. The thing is, you don't even
know it's a problem, because the graphic shows just fine when you
view it on your computer. In the above example, when the browser
asks for the image, it looks on the C drive, then in the "Web
Folders" directory, then in the "MyStupidWebFolder"
directory, and finally in the "images" directory. The
browser looks in this location whether the page is on your hard
drive or on the server.
The
problem is, while it displays just fine for the person who created
the page (when viewing on the computer where they created the page),
no one else can see the locally referenced graphic. Why? Because
first the browser looks on the visitor's own C drive, and then in
their "Web Folders" directory, then in the "MyStupidWebFolder"
directory, which doesn't exist on the visitor's computer. So the
graphic cannot be found, and cannot be displayed. Whenever someone
calls you and says "I can't see any graphics on your Web site,"
and you say, "It looks just fine on my site," this is
probably the problem.
Preventing
Local File References
Using Dreamweaver, I've been able to create local file references
the following way (Do not try this at home or in the office! I'll
get mad!)
-
Tell Dreamweaver to Insert Graphic.
-
Select a graphic from outside your defined site.
-
When Dreamweaver tells you that the graphic is outside of the
root folder of your current site, warns you (hint, hint) that
the graphic may not be accessible when you publish the site, and
asks you if you want to copy the file to your root folder, say
"No."
Congratulations,
you've made a local file reference, and you upload the page, the
graphic will not be visible to anyone except someone using your
computer.
To
prevent this from happening, follow Bob's Mantra: Define your
site folder. Everything that is to appear on your site must
be in this folder (or sub-folders), and nothing that won't be on
your site (including raw files used to build your graphics) should
be in this folder.
If
you test your Web pages on your neighbor's computer, you will be
able to quickly catch such errors. You can also search your source
code for "file:" to discover any local references.
Fixing
local file references
Manually: Copy the necessary graphic files (or folders)
to your defined site folder. Then go into Dreamweaver, click on
all your image files, and update the reference (in the Properties
Inspector's "src" field) to the file that is in your folder.
Automated:
Dreamweaver has some excellent Search & Replace functions that
come in handy here. In the above example, if you have moved the
graphic to the /images folder of your root directory, simply
search your source code for file:///C|/Web%20Folders/MyStupidWebFolder/images/ce_01.gif,
and replace with images/ce_01.gif. Of course, that only works
for the ce_01.gif image. If you've done this boo-boo with
a bunch of images, you might search for file:///C|/Web%20Folders/MyStupidWebFolder/images/,
and replace with "images/".
Dreamweaver allows you to perform Search and Replace on a single
document, a folder, or the entire site. Since your paths can
change for different folders, do not use this technique on the entire
siteusing it on a single folder at a time is much safer.
|
|
Have
a Web
question?
Ask
Bob
Hoffmann
|
|