Link to home
Start Free TrialLog in
Avatar of dwcronin
dwcroninFlag for United States of America

asked on

relative paths for hyperlinks

I am using OpenOffice Impress.  I want to make a hyperlink that uses a relative path to a text file I have.  I want to put the impress file and stuff.txt in the same directory.  I then want to use "./stuff.txt" as the path of the file that I want to include as a hyperlink in my impress file.  

I can get it to work if I use an absolute path to stuff.txt.  I want to use relative paths so I can mail the impress file and stuff.txt to someone.  

Any ideas?
Avatar of xberry
xberry
Flag of Germany image

Hmm, maybe I don't quite get it but ...

if you choose
Insert > Hyperlink > Document: and for Path click on the folder icon you then can
insert any kind of document from your filesystem as a target for your link.
I mean what I don't quite get here, sorry:

>>>I want to use relative paths so I can mail the impress file and stuff.txt to someone

??? Do you want to create hyperlinks for your impress slide or
organize your mail programm ? both things seem not really related to me.
Avatar of dwcronin

ASKER

Sorry for the delay xberry but I asked the question right before I left work on Friday and I did not look after I got home on Friday evening.

The problem I have is:
I have written an impress slide that has names of all subroutines in a program someone gave me to fix.  So I have the main impress slide that has the names of all of subroutines.  I try to make hyperlinks from this main page to slides showing the code in the subroutine referenced in the main slide.  A couple subroutines have a significant amount of code written.  I made text files for each of those subroutines instead of having the main page reference a slide for the function, Then the main page references the text file for the particular function.

Say that my text files are:
one.txt
two.txt
three.txt

When I hyperlink to these, it put the path in as:
/home/cronind/one,txt
/home/cronind/two,txt
/home/cronind/three,txt

This works fine on my computer because I am cronind and these are the correct paths on my computer.  This will not work if I send my impress file and three text files to my boss.  How do I make the main page reference:

./one,txt
./two,txt
./three,txt

Thanks.
I did browse for help and related issues and as a summary it should work if you
follow these:

- Check the relative links checkboxes under Tools | Options | Load/Save | General.
- Copy your entire directory structure to an unrelated location, i.e your bosses computer.

Then, so it is said, it should work, though this is not sideproofed from my side.

from open office help file:

Relative and Absolute Links:
When you include hyperlinks, two factors must be taken into account: whether they are set as relative or absolute on saving, and whether or not the file is present.
Choose Tools - Options - Load/Save - General and specify in the Save URLs relative to field if OpenOffice.org creates relative or absolute hyperlinks. Relative linking is only possible when the document you are working on and the link destination are on the same drive.
You should create the same directory structure on your hard disc as that which exists in the web space hosted by your Internet provider. Call the root directory for the homepage on your hard disc "homepage", for example. The start file is then "index.htm", the full path being "C:\homepage\index.htm". The URL on your Internet provider's server might, then be as follows: "http://www.myprovider.com/mypage/index.htm". With relative addressing, you indicate the link relative to the location of the output document. For example, if you placed all the graphics for your homepage in a subfolder called "C:\homepage\images", you would need to give the following path to access the graphic "picture.gif": "images\picture.gif". This is the relative path, starting from the location of the file "index.htm". On the provider's server, you would place the picture in the folder "mypage/images". When you transfer the document "index.htm" to the provider's server through the File - Save As dialogue, and if you have marked the option Copy local graphics to Internet under Tools - Options - Load/Save - HTML Compatibility, OpenOffice.org will automatically copy the graphic to the correct directory on the server.
An absolute path such as "C:\homepage\graphics\picture.gif" would no longer function on the provider server. Neither a server nor the computer of a reader needs to have a C hard drive: operating systems such as Unix or MacOS do not recognise drive letters, and even if the folder homepage\graphics existed, your picture would not be available. It is better to use relative addressing for file links.
A link to a web page, for example, "www.sun.com" or "www.myprovider.com/mypage/index.htm" is an absolute link.
OpenOffice.org also reacts differently, depending on whether the file referred to in the link exists, and where it is located. OpenOffice.org checks every new link and sets a target and protocol automatically. The result can be seen in the generated HTML code after saving the source document.
The following rules apply: A relative reference ("graphic/picture.gif") is only possible when both files exist on the same drive. If the files are on different drives in your local file system, the absolute reference follows the "file:" protocol ("file:///data1/xyz/picture.gif"). If the files are on different servers or if the target of the link is not available, the absolute reference uses the "http:" protocol ("http://data2/abc/picture.gif").
Be sure to organise all files for your homepage on the same drive as the start file of the homepage. In this way, OpenOffice.org can set the protocol and target so that the reference on the server is always correct.

When you rest your mouse on a hyperlink, a help tip displays the absolute reference, since OpenOffice.org uses absolute path names internally. The complete path and address can only be seen when you view the result of the HTML export, by loading the HTML file as "Text" or opening it with a text editor.
ASKER CERTIFIED SOLUTION
Avatar of xberry
xberry
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial