PDA

View Full Version : Creating document links offline



easouza
24 Jul 2010, 12:59 PM
I am new to web development although over 30 years mini, mainframe and client server experience. I am starting a new business and to save money, I'm doing it myself. To save even more money and time, I made the decision to go initially with an expedient solution--a Microsoft Publisher web site template that I already owned in Office 2007. I have created 9 pages and made numerous customizations just fine. There is only one issue standing between me and my "real" web site: links to PDF files.

When I enter a hyperlink to a file in MS Pub, it stores the full path such as K:\samples\documentname.pdf. For offline testing, I am using XAMPP since my hosting service supports Apache server and MySQL. Of course, when I publish my pages to the web and copy that folder to XAMPP, everything works perfectly except the links to the PDF files in Samples. The path that XAMPP would need is http://localhost/business/samples/documentname.pdf. The path I think my hosting site will use is just http://localhost/samples/documentname.pdf. Once I publish in MS Pub the output cannot be edited so all changes have to be made in MS Pub.

My question is: Is there a way to write the path to the file so it is relative to wherever it finds itself; that is, that Web Preview in MS Pub can find it in Samples, XAMPP can find it in Samples and my hosting site can find it in Samples?

The only workaround I've been able to come up with is to add these files to the generated index files folder but I think that gets completely replaced every time you do a publish in MS Pub.

I am interested in pursuing how more experienced deveopers deal with this issue since my plans to do my ultimate site also includes an offline solution, Web Studio 5, and I may run into the same issue there.

Boy, this got long, so thanks for any advice you can provide.

Eileen

<CrGeary.com/>
24 Jul 2010, 05:02 PM
Yeah you can do relative links really easily, it is basically like this:

You use your current location ( the directory your in ) as the base, so, your current page is: http://www.example.com/user/profile.php and you want to link to: http://www.example.com/user/user_data/images/uploads/image_file.jpg

Then you just put this in the link:

user_data/images/uploads/image_file.jpg