Questions tagged [relative-path]

Relative-paths are URI or directory links to resources that refer to a location relative to the current path.

A relative path references a resource in relation to a current path or directory; its opposite is an absolute path. Web pages frequently make use of relative paths to refer to resources like images and scripts. The advantage of using a relative path is that it remains valid when the host name or root path changes.

As an example, consider a website located at the URL:

http://www.hostname.com/site/page.html

If the page wants to reference an image located at:

http://www.hostname.com/site/images/image.jpg

It could simply make reference to the relative path images/image.jpg.

2470 questions
24
votes
5 answers

How to accomplish relative import in python

stuff/ __init__.py mylib.py Foo/ __init__.py main.py foo/ __init__.py script.py script.py wants to import mylib.py This is just an example, but really I just want to do a relative import…
random
  • 573
  • 1
  • 4
  • 9
24
votes
13 answers

Transform relative path into absolute URL using PHP

How to, using php, transform relative path to absolute URL?
Paul
  • 1,928
  • 8
  • 24
  • 32
23
votes
7 answers

Getting relative paths in Vim

Say I am running Vim and pwd returns /home/rafid/myproject And say I am currently editing the file /home/rafid/myproject/website/editpage.php Is there any command that returns this for me? website/editpage.php That is, the path of the file…
Rafid
  • 18,991
  • 23
  • 72
  • 108
23
votes
3 answers

Relative Paths From Partials Referencing Other Partials

I am using a (primary) partial: <%= render partial: 'shared/page/head' %> Which makes use of other (secondary) partials: <%= render partial: 'shared/page/head/title' %> <%= render partial: 'shared/page/head/meta' %> ... <%= render…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
22
votes
6 answers

How do I put a hyperlink to "two levels above in the directory tree"?

I am trying to code my Home button. Is there a way to just climb back up the file structure, instead of using the absolute path like I have below. I have a file index.html that I have at C:\Users\Randy\Documents\XML\ Heres my code:
user770022
  • 2,899
  • 19
  • 52
  • 79
22
votes
5 answers

Relative Path Problems in Javascript Ajax call

Okay, I have a JavaScript file with the following functions: function AskReason() { var answer = prompt("Please enter a reason for this action:", ""); if (answer != null) DoReason(answer); } function createXMLHttpRequest() { try…
MDV2000
  • 812
  • 2
  • 9
  • 14
21
votes
5 answers

ASP MVC Friendly URL's and Relative Path Images

I have an ASP.NET MVC page, where I am trying to show friendly URL's. So, I have a Category View in the Home Controller, that accepts a categoryKey value to get the content of the page. For instance: http://localhost/Home/Category/Bikes gets the…
doug
  • 233
  • 1
  • 3
  • 7
21
votes
3 answers

Relative Path issue with .Net Windows Service..?

I have a windows service which is trying to access an xml file from the Application directory. Windows Service Installed directory : C:\Services\MyService\MyService.exe Path of the xml file : C:\Services\MyService\MyService.xml I am trying to…
Amitabh
  • 59,111
  • 42
  • 110
  • 159
21
votes
3 answers

Should I use Url.Content() or ResolveUrl() in my MVC views?

When building code like this: or " /> Should I use Url.Content or ResolveUrl()? What's the difference?
Michael Haren
  • 105,752
  • 40
  • 168
  • 205
21
votes
3 answers

PHP include absolute path

I have a variable on my site called $basePath which is set as: $basePath = '/Systems/dgw/'; I am using it on all my css, js and images tags as so (shortened for better visibility):
digicom
  • 538
  • 3
  • 7
  • 20
21
votes
6 answers

iText – HTML to PDF - Image is not displayed in PDF

I have a html page with text, image and I am parsing the HTML content to iText to generate the PDF. In the generated PDF,Included images are not getting displayed and , only the text is getting displayed. If I pass the absolute path like…
Deiva
  • 295
  • 2
  • 4
  • 5
20
votes
2 answers

Confusion about URI path to configure SQLite database

Hi I am building a web application using Flask and Sqlite3. I had issues with connecting the database for a while and it did not work when I wrote this: #version 1 app.config['SQLALCHEMY_DATABASE_URI']…
bubble rain
  • 411
  • 1
  • 5
  • 10
20
votes
3 answers

Correct File Path within C# Console Application

Can someone please tell me how I can get the correct file path for the file data.xml? Here is where the file sits: Here is my C# code that is checking to see if the file exists for the supplied path: public class Parser { static void…
J86
  • 14,345
  • 47
  • 130
  • 228
20
votes
1 answer

Absolute (full) URLs without "http:" in HTML href

I have been seeing this a lot lately and I am unable to find any information on it. Is there a name for it? Which browsers support this?
Xen
  • 442
  • 1
  • 4
  • 13
20
votes
4 answers

Relative file paths in Python packages

How do I reference a file relatively to a package's directory? My directory structure is: /foo package1/ resources/ __init__.py package2/ resources/ __init__.py script.py script.py imports packages…
Alex
  • 43,191
  • 44
  • 96
  • 127