Re: Absolute / relative paths problem
Eric Laffoon <[email protected]>
| Newsgroups | gmane.comp.kde.devel.quanta.user |
|---|---|
| Organization | KDE WebDev |
| Message-ID | <[email protected]> |
On Thursday 15 March 2007 11:51 pm, Oliver König wrote: > On Friday 16 March 2007 01:49:18 Eric Laffoon wrote: > > On Thursday 15 March 2007 1:30 pm, Oliver König wrote: > > > Hello, > > > I have got a website on a remote server. All files on the website use > > > absolute paths to other files and images: > > > > > > Document root (in Apache is): > > > /www/htdocs/ > > > > > > For example the file index.html in /www/htdocs/ has an image: > > > <img src="/images/img.png"> > > > and a link to another page: > > > <a href="/folder/page.html">page</a> > > > Apache then looks at /www/htdocs/images/img.png for the image and > > > at /www/htdocs/folder/page.html for the file. > > > > > > I downloaded all files to /www/htdocs/ on my Notebook. I opened Quanta > > > 3.5.6. I created a new Quanta project and in "Directory Settings" I > > > defined /www/htdocs/ as the main directory and inserted all files > > > from /www/htdocs/ into the project. > > > > > > Problem: > > > When I open a html file in Quanta with the VPL editor or the preview > > > the images do not display and the hyperlinks do not. It looks like > > > Quanta cannot handle absolute links. How can fix this problem without > > > changing all references from absolute to relative? > > > > > > Thanks > > > > > > Oliver > > > > This is funny. First I thought you were dealing with temp files, then I > > re-read it. Quanta does handle absolute links. The problem is you not > > differentiating between the file tree and the server tree. You have > > absolute document root links - "/images/img.png" and absolute file > > linkes - /www/htdocs/folder/page.html. So the question is, what > > does "absolute" men to you? > > I mean absolute document root links. I know, but you used both as if interchangeable. > > > Quanta is inherently in your file system, not > > your web server and interprets absolute in reference to your file system > > as it is not privileged to know you intend to mirror a server system... > > Does that mean Quanta does not handle absolute document root links. No of course not! It means you haven't told it to use this. > In > Dreamweaver I never had a problem with the absolute document root links. We're not Dreamweaver, which is why a lot of people will never go back. We don't really care what they do, like use the site as a repository, eschew version control and use proprietary hacks to make HTML do what should have been done with PHP. However we do have to accommodate people who got locked into their approach. > > > First of all it is recommended not to use absolute references in your > > site for this very reason. > > It would take years to change all the links in my website to relative > document root. the advantage of the absolute document root links is that I > can move any html file to any directory or subdirectory below document root > and all links and refenrences will always work. You could change them in minutes with KFilereplace if you wanted to. You can also use the base tag in HTML to accomplish this. I personally set up a per directory addressing file using PHP and give it the same name in all directories, then include it in all files. That way I can also manage included files and files across subdirectories. > > > Quanta can also deal with projects setting a project > > preview which is typically used to see PHP through a local server. > > Provided you have Apache running this works, and it should work without > > it for HTML as it is just setting a reference. Alternately you could set > > a <base> tag too, but then that's just another way of making things > > interesting with what you're doing. > > I don't have Apache running on my notebook (but I could do that if needed). > So, what should I do now? I am not sure if you need it. I always do for PHP, but if you are just pointing there in a file tree address it should work assuming the address is accepted. If not then using Apache will certainly work and as a bonus you can integrate server side scripting at any time and live test it. Just look at the project preview address in the project dialog and put your document root in there. If it doesn't accept a file:/ address set up Apache and use http://localhost/. -- Eric Laffoon - Quanta+ Team Leader http://quanta.kdewebdev.org