Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP File Navigation (Local + Remote)
    text
    copied!<p>I have been working on a content management system (nakid) and one of my toughest challenges is the file navigation. I want to make sure the file paths and settings work on local and remote servers. Right now my setup is pretty much something like this:</p> <p>first.php (used by all pages):</p> <pre><code>//Set paths to nakid root $core['dir_cur'] = dirname(__FILE__); $core['dir_root'] = $_SERVER['DOCUMENT_ROOT']; //Detect current nakid directory $get_dirnakid_1 = str_replace("\\","/",dirname(__FILE__));//If on local $get_dirnakid_2 = str_replace("/includes/php","",$get_dirnakid_1); $get_dirnakid_3 = str_replace($_SERVER['DOCUMENT_ROOT'],"",$get_dirnakid_2); //remove first "/" if(substr($get_dirnakid_3, 0,1) == "/"){ $get_dirnakid_3 = substr($get_dirnakid_3, 1); } //Set some default vars $core['dir_nakid_path'] = $get_dirnakid_3; $core['dir_nakid'] = $core['dir_root']."/".$core['dir_nakid_path'];//We need to get system() for this real value - below </code></pre> <p>The reason I also did it this way is because I want the directory that this program is sitting in to be anywhere on the server ie(/nakid)(/cms)(/admin/cms) </p> <p>I'm positive I am doing something the wrong way or that there is a simpler way to take care of all this.</p> <p>If it helps to get a closer look at the code and how everything is being used I have it all up at nakid.org</p> <p>EDIT: Just realized what I have at nakid.org is a little different than my newly posted code, but the same idea still applies to what I am attempting to do.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload