Page 1 of 1

Relative paths in snippets

Posted: Tue Sep 30, 2008 12:12 pm
by bbuchko
Hey folks, this is a neat tip that's probably old news to the pros here but might be useful to other newbies like me.

I have video links in my project, which lead to files outside of the project itself but still in a persistent directory structure, so I used relative paths to link them, such as:
../../../../help_videos/video1.htm

I found myself linking over to the video page a lot, so I decided to just make the video and its description into a snippet. The problem, then, was that my relative path was breaking if I placed the snippet into a topic on a different level of the directory hierarchy.

So, for instance, if I added it to this topic:
/Output/Content/Job_Openings/Adding_Jobs/Uploading_Files.htm (4 levels of directories)

Then I also added it to this topic:
/Output/Content/Portfolios/What_are_Portfolios.htm (3 levels of directories)

One of the two would be broken since they were at different levels of the directory hierarchy (the first would need to backtrack 4 levels while the second only needed to backtrack 3 levels).

So how to fix this problem? What I found was that, if you begin a "Topic in project" link with a slash, Flare automatically adjusts the backtracking to take you back to the target directory. So, instead of the original link above, I could instead use:
/../../../help_videos/video1.htm (also see the attached image)

Now, in my topics, Flare automatically adjusts it to add as many extra levels of backtracking as necessary, based on the topic it's placed into! If I look at the output frame source, sometimes the snippet link is:
../../../../../../help_videos/video1.htm

and sometimes it's only:
../../../../help_videos/video1.htm

Etc.

Verrry handy.

Re: Relative paths in snippets

Posted: Tue Sep 30, 2008 1:21 pm
by KevinDAmery
Good tip - I've made this post sticky so people can find it more easily.

Re: Relative paths in snippets

Posted: Wed Oct 01, 2008 1:57 am
by MC Hammer
Sorry but I do not understand why you are using hyperlinks? Don't you insert your snippet in your target topics by going to Insert | Snippet?

Re: Relative paths in snippets

Posted: Wed Oct 01, 2008 8:16 am
by KevinDAmery
It's a solution for how to have a hyperlink that's part of a snippet work even if the relative paths from the resulting topics are different. It's not about inserting the snippet, it's about making the hyperlink inside the snippet work everywhere in the help system.

Re: Relative paths in snippets

Posted: Wed Oct 01, 2008 12:52 pm
by bbuchko
Sorry, I can understand the confusion. I wasn't very clear about that.

As Kevin noted, it's only if you want to include a hyperlink inside of the snippet, and the link is relative instead of absolute (for example, if you want to use "../../NotMyFlareProject/videos/Linkpage.htm" instead of "http://www.myserver.com/NotMyFlareProje ... nkpage.htm").

Re: Relative paths in snippets

Posted: Thu Oct 02, 2008 12:10 am
by MC Hammer
Hi both
Thank you for clarifying things for me (I was being a bit thick :oops: ).
I understand now and I have had this issue in the past. It is a nice trick, thanks for sharing, I shall use it!

Re: Relative paths in snippets

Posted: Mon Oct 06, 2008 6:45 am
by JupiterJones
Thanks for the tip! I will try it.
I had a similar problem with broken table stylesheet links in some of my snippets...