Jump to content

Proper Use of Path Structure for Folder Structure with Multiple Levels?


Glese

Recommended Posts

When having different levels of directories, using relative paths will not work anymore, for example:

 

 

controller

- authentication

 

File 1: include('../../model/header.php')

 

 

 

model

 

File 2: header.php

 

 

 

view

 

File 3. style.css

 

 

 

The header.php file includes the css file with a relative path, but the problem is it includes it as follows: ../view/style.css

 

 

When now the header.php file gets included into File 1 in the folder "authentication", then the css file will not be accessible anymore, for it to be accessible you would have to go two directories up.

 

In this sense my question is, what would be the proper path structure for a folder structure with multiple levels? Should I rather use absolute paths, I am not so prone of absolute path. What if the folders changes a bit, or the domain changes, or the location changes?

I think what I actually have to do is, I have to make the css file an absolute path.

 

Though how do you do an absolute path on a local server?

 

c:/ et cetera did not work for me and http://localhost/ et cetera did not work for me either. Any suggestions?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.